Groups | Blog | Home
all groups > dotnet remoting > august 2005 >

dotnet remoting : HELP: Dymamically create IPC channels in windows service application(newbie)


Hank
8/18/2005 5:31:28 PM
Hi, experts:
I am writing a windows service application in C# which will dynamically
create IPC channels upon receiving client requests(both service and clients
running on the same machine, so I choose IPC instead of TCP or HTTP).
following are my questions:
(1)How do I dynamically get free PORT from the system?
(2)after I get the PORT and register the IpcChannel, how to let my client
know the PORT number, so it can register the IpcChannel with right port
correspondingly?
(3)if both server and client register IpcChannel correctly, server will
expose some interface methods for client to call. How do client set an
asynchronous callback in the channel to receive response from server?
Your help is highly appreciated!
Hank

Metallikanz!
8/19/2005 12:00:00 AM
They are many ways in which this can be done, you could probably let the =
client specify which channel to use, so that it doesn't have to be =
communicated back again. But I don't understand, why do you need 'n' =
number of client-server pairs, it should instead be that there's only =
one server which services the request of every client that would want to =
connect to it. If your concern is about maintaining state you should use =
an CAO. More details would really hip in getting the correct solution to =
your issue.

HTH, Metallikanz!=20


[quoted text, click to view]
Hank
8/20/2005 11:33:56 PM
Thanks for the response. here is the details:

1. the client will be GUI(windows form handling Imaging processing), =
there could be multiple instances of GUI running on the same PC. Each =
GUI can make request to multiple image capturing devices through server.

2. the server(Only ONE server) should handle multiple GUI instances =
requests, it will also connect to multiple image capturing =
devices(through DLLs)

3. my thoughts are every time a new client(GUI) initialized and a device =
is picked by client(GUI), it will make a request to the server through a =
general IPC channel(the port number can be preset here), the server will =
create a new IPC channel for the selected device and send the response =
back to the client with the right port and endpoint so client can create =
and register the right channel to communicate. Next time if the same =
client(GUI) picks a new device or a new client(GUI) initialized and pick =
a device, then send the request to the server through the same general =
IPC channel, the server should create another IPC channel.=20

4. so the server has a general IPC channel and a list of IPC channels =
created and registered dynamically upon the request from the =
client(GUI). on client side(could be multiple clients), there will be =
the same number of IPC channels created and registered.

=20

If my design is OK, the questions will be

(1)how the server to get a FREE port so it can dynamically create and =
register an IPC channel upon initial request from the client for a new =
device.

(2)if the server gets the port and successfully create and register the =
IPC channel, how to let client know(the port number and the endpoint) so =
it can create and register the correct channel to communicate with =
server.

(3)if both server and client register IpcChannel correctly, server will =
expose some interface methods for client to call. How do client set an =
asynchronous callback in the channel to receive response from server?

=20

if my approach is not good, please advise.

Thanks!

Hang

[quoted text, click to view]
They are many ways in which this can be done, you could probably let =
the client specify which channel to use, so that it doesn't have to be =
communicated back again. But I don't understand, why do you need 'n' =
number of client-server pairs, it should instead be that there's only =
one server which services the request of every client that would want to =
connect to it. If your concern is about maintaining state you should use =
an CAO. More details would really hip in getting the correct solution to =
your issue.

HTH, Metallikanz!=20


[quoted text, click to view]
Metallikanz!
8/21/2005 10:40:49 AM
I think you should use a combination of a SAO and a CAO in a factory =
pattern as your implementation. Register a SAO as a Singleton, which has =
a wellknown set of configuration details. This type does nothing on it's =
own other than creating the actual object which interacts with the =
devices and contains the actual logic, to every GUI client of yours =
which asks for an instance. If you have got your interfaces right then =
each client will know which device it has to connect to (maybe the GUI =
client supplies this will asking for an instance), and this way you can =
have 'n' number of instances connected or handling 'n' number of =
devices. You just have to publish the singleton instance and the FW will =
take care of properly remoting the call for each CAO you create for each =
GUI. Since, it's a CAO state management will be automatically taken care =
of.

HTH, Metallikanz!

[quoted text, click to view]
Thanks for the response. here is the details:

1. the client will be GUI(windows form handling Imaging processing), =
there could be multiple instances of GUI running on the same PC. Each =
GUI can make request to multiple image capturing devices through server.

2. the server(Only ONE server) should handle multiple GUI instances =
requests, it will also connect to multiple image capturing =
devices(through DLLs)

3. my thoughts are every time a new client(GUI) initialized and a =
device is picked by client(GUI), it will make a request to the server =
through a general IPC channel(the port number can be preset here), the =
server will create a new IPC channel for the selected device and send =
the response back to the client with the right port and endpoint so =
client can create and register the right channel to communicate. Next =
time if the same client(GUI) picks a new device or a new client(GUI) =
initialized and pick a device, then send the request to the server =
through the same general IPC channel, the server should create another =
IPC channel.=20

4. so the server has a general IPC channel and a list of IPC channels =
created and registered dynamically upon the request from the =
client(GUI). on client side(could be multiple clients), there will be =
the same number of IPC channels created and registered.

=20

If my design is OK, the questions will be

(1)how the server to get a FREE port so it can dynamically create and =
register an IPC channel upon initial request from the client for a new =
device.

(2)if the server gets the port and successfully create and register =
the IPC channel, how to let client know(the port number and the =
endpoint) so it can create and register the correct channel to =
communicate with server.

(3)if both server and client register IpcChannel correctly, server =
will expose some interface methods for client to call. How do client set =
an asynchronous callback in the channel to receive response from server?

=20

if my approach is not good, please advise.

Thanks!

Hang

"Metallikanz!" <NoSpam---abhilash.panickar@gMail.com> wrote in =
message news:elPan6TpFHA.4056@TK2MSFTNGP10.phx.gbl...
They are many ways in which this can be done, you could probably let =
the client specify which channel to use, so that it doesn't have to be =
communicated back again. But I don't understand, why do you need 'n' =
number of client-server pairs, it should instead be that there's only =
one server which services the request of every client that would want to =
connect to it. If your concern is about maintaining state you should use =
an CAO. More details would really hip in getting the correct solution to =
your issue.

HTH, Metallikanz!=20


[quoted text, click to view]
AddThis Social Bookmark Button