472,958 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

writing a service that broadcasts events to its controllers and isremotely callable

hi,

I know its possible to create a service by Inheriting from ServiceBase
and
controlling it from ServiceController.

BUT, how do I have the service broadcast an event to the service
controllers, _and_ how do I control the service across a network/or
from
networked computers.

I know this is probably possible with WCF, or .NET remoting, but is it
possible with plain .NET??

Could someone tell me how its possible in each technology and which
would be
the simplest to implement.

I'm trying to write a data service that serves and receives
data[represented
by objects] and should broadcast a notification when the data has been
updated.

Thanks so much
Sep 1 '08 #1
6 1142
giddy wrote:
hi,

I know its possible to create a service by Inheriting from ServiceBase
and
controlling it from ServiceController.

BUT, how do I have the service broadcast an event to the service
controllers, _and_ how do I control the service across a network/or
from
networked computers.

I know this is probably possible with WCF, or .NET remoting, but is it
possible with plain .NET??

Could someone tell me how its possible in each technology and which
would be
the simplest to implement.

I'm trying to write a data service that serves and receives
data[represented
by objects] and should broadcast a notification when the data has been
updated.

Thanks so much
You can do it via direct socket connections.
If you need to "discover" your server from a client you can do a UDP
broadcast where your server would have to respond and then initiate a
direct connection.

JB

-- Posted on news://freenews.netfront.net - Complaints to ne**@netfront.net --
Sep 1 '08 #2
Yea I know I could do it that way, but I was hoping to learn a little
about distributed apps by trying this with remoting or WCF both of
which I know nothing about.

I just managed to learn how to call an object over a network with the
remoting classes but I still havn't managed to figure out a way to
control/call an instance of a class over a network.
So could anyone tell me how to accomplish this with remoting or WCF.

Thanks so much
Gideon
Sep 1 '08 #3
"giddy" <gi*******@gmail.comwrote in message
news:a0**********************************@v13g2000 pro.googlegroups.com...
I know its possible to create a service by Inheriting from ServiceBase
and
controlling it from ServiceController.

BUT, how do I have the service broadcast an event to the service
controllers, _and_ how do I control the service across a network/or
from
networked computers.

I know this is probably possible with WCF, or .NET remoting, but is it
possible with plain .NET??
It's not clear what you mean by "plain .NET" - there's no such thing as far
as RPC is concerned. You can, of course, do it using WCF or .NET Remoting,
by hosting the corresponding listener thread inside your service process.
Could someone tell me how its possible in each technology and which
would be the simplest to implement.
For details on making your application a WCF or .NET Remoting service host,
see the two following MSDN articles:

http://msdn.microsoft.com/en-us/library/ms730935.aspx
http://msdn.microsoft.com/en-us/library/ecc85927.aspx

They are fully applicable to any type of application, including a Windows
service.

Sep 1 '08 #4
hi,

You will have to excuse my illeteracy with remoting I've bee
researching a LOT today and I found out about things like
RemotingConfiguration . RegisterWellKnownServiceType.

There is one problem with it, how do I allow an *instance* of an
object to be callable across processes?

Something like:

App2:
TextBox txtBox1;

TcpServerChannel channel = new TcpServerChannel(9988);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType (typeof(TextBox),
"TextBox", WellKnownObjectMode.SingleCall);//***can't i say txtBox1??
***

App2:
ChannelServices.RegisterChannel(new TcpChannel(),false);
TextBox t = (TextBox)Activator.GetObject(typeof(TextBox), "tcp://
localhost:9988/TextBox");
t.ForeColor = Color.Blue;
//Doesn't work!!?

Thanks so much

Sep 1 '08 #5

"giddy" <gi*******@gmail.comwrote in message
news:54**********************************@q26g2000 prq.googlegroups.com...
hi,

You will have to excuse my illeteracy with remoting I've bee
researching a LOT today and I found out about things like
RemotingConfiguration . RegisterWellKnownServiceType.

There is one problem with it, how do I allow an *instance* of an
object to be callable across processes?
You provide a factory as a well-known type that exposes the rest of the
objects in your application via properties and methods such as GetTextBox().
On the client, you obtain instance of that type, and then call its methods
to get proxies for those objects.

One thing, though. If you're doing remote calls over the network, I would
strongly advise to avoid traditional instance-centric object-oriented
approach in the remoting layer, and implement a stateless remote facade
instead. There are numerous reasons to do so, having to do with performance
as well as reliability, and rather than going into detail here, I'll just
refer you to the description of the remote facade pattern:

http://martinfowler.com/eaaCatalog/remoteFacade.html
http://martinfowler.com/eaaCatalog/d...ferObject.html

In this case, you can stick to using well-known types and SingleCall. For
..NET remoting, this also avoids lifetime management issues, which can get
messy with large object graphs.
Sep 1 '08 #6
hi,

Thanks so much for your reply. The facade finally makes more sense to
me now!!

I got exactly what I was looking for from this article though:
http://www.codeproject.com/KB/IP/remotinggui.aspx

He uses RemotingServices.Marshal() whichallows one to register an
*instance*.
I want to bother you with just one more thing.

On the server:

TcpChannel channel = new TcpChannel(9988);
ChannelServices.RegisterChannel(channel,false);
RemotingServices.Marshal(textBox1, "textBox");

And on the client:
ChannelServices.RegisterChannel(new TcpChannel(), false);
t = (TextBox)Activator.GetObject(typeof(TextBox), "tcp://localhost:
9988/textBox");
//t.TextChanged += new EventHandler(t_TextChanged); //works fine
untill i add THIS line.

Tells me:
Type System.DelegateSerializationHolder and the types derived from it
(such as System.DelegateSerializationHolder) are not permitted to be
deserialized at this security level.

I searched online and tried changing some filter setting to full
through config files, doesn't work, and I tried it with code I get a
TargetInvocationException, I'm probably doing something silly, could
you please help!?

Thanks so much

Gideon
Sep 2 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Marian Aldenhövel | last post by:
Hi, I am using the FMOD audio-library with the pyFMOD python bindings. pyFMOD uses ctypes. It is possible to register callback functions with FMOD that are called at certain points in the...
0
by: Yage | last post by:
Hi, im developing a small app in compact framework. This app sends Udp broadcasts to 0.0.0.0 (this is needed because the machine can be in multiple subnets and broadcasts need to be sent to each...
23
by: Adam Clauss | last post by:
I have a C# Windows Service running as the NetworkService account because it needs to access a network share. As part of the service's initialization, I want the service to terminate, if an...
11
by: TheBurgerMan | last post by:
Hi all. I am using W2K3, .NET2 on a machine running AD and Exchange. I started getting the message below last week. I googled the error and not much was returned, but I did find this;...
1
by: tim | last post by:
Someone using Python Midi Package from http://www.mxm.dk/products/public/ lately? I want to do the following : write some note events in a midi file then after doing that, put some controllers...
4
by: carson | last post by:
I have written two windows services: - service A does some crunching of local data files and uploads them to a central processing computer via http. - service B monitors a manifest file on a...
0
by: Gianmaria Iaculo - NVENTA | last post by:
Hi there, i found a nice article about a custom implementation of events by Duncan Booth here: http://www.suttoncourtenay.org.uk/duncan/accu/pythonpatterns.html#observer The code is here: ...
1
by: Susan Harris | last post by:
I have a Windows (NT) service developed in .NET 3.5 (VS2008). I want this service to log messages to a WinForms application that will display it's progress to the user. It has to run under Vista,...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.