Windows Service, Sharing Data

G

Guest

Hey all....

I'm writing an app that needs to send/recieve data from other applications
running, I guess you could think of it as a data relay broker between running
applications. I had planned on creating a windows service to handle this,
but I found out that I cannot directly send/recieve data here, i can only
signal it. First off, am I wrong in this assumption? Secondly, I have also
noticed some people talking about creating a remoting application to handle
this task (which is controlled by the windows service I would assume). Does
anyone know of some examples here or some good references so I could brush up
on my remoting?? If I create a .NET remoting app which would act as the
broker, does the user need IIS installed?

Thanks in advance, Jason
 
J

John Spiegel

Hey Jason,

I won't claim to be an expert on remoting but have been recently learning a
lot about it...

Remoting doesn't require IIS on either side, but may be simpler to use it if
you're wanting the security features rolled for you. What I've been finding
is that the more difficult side of remoting is determining when to use which
function/option than it taking hundreds of lines of code to set up.

The only resource I've been using is a test-prep book. The following
probably won't be enough to code everything, but as an idea of how much (or
little) is involved, basically, you register the server with something like:

TcpServerChannel channel = new TcpServerChannel(1234);

ChannelServices.RegisterChannel(channel);



RemotingConfiguration.RegisterWellKnownServiceType(

typeof(MyProject.MyClass),"MyClass",

WellKnownObjectMode.SingleCall);



This defines the protocal and port on which the service is going to listen
for requests. On the client side, you add project references to the server
assembly, then do something like the following to create an instance of the
service (or more accurately a proxy to it):



TcpClientChannel channel = new TcpClientChannel();

ChannelServices.RegisterChannel(channel);



RemotingConfiguration.RegisterWellKnownClientType(

typeof(DbConnect), "tcp://j2k:1234/MyClass");



MyClass ServerOjbect = new MyClass();



Now you can work with the ServerObject as any other.



Overall, it seems to involve as much or more work getting the references and
"usings" in place than the amount of coding to make your objects remotable!



I hope that's at least a start...



John
 
G

Guest

For Remoting, my advice is to read Ingorammer's book. He has a website
ingorammer.com. You do not need to use IIS if you do not want to.

As for the Service, you can write a listener which listens for the data and
then send the data some other location. But if you want to interact with
another app, Remoting might be the way to go.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top