Networking Question
-
Hi everybody I an all the examples that I have studied so far with regards to remoting there is a server and many clients that communicate with it using either TCP/IP or HTTP. What kind of communication protocol can we use for the case of windows forms that communicate with other windows forms and need to pass data to them. So instead of having a pool of sockets to connect, we have the server (window form father) to create and then send data to the new window form (window form child) and then wait until the child window returns some results. If we use TCP/IP and config files all child processes will use the same port. From my small exeprience I believe that this is at least incorrect. So my question is: does anyone know am effective way to perform that type of communication? Thank you very much for your time. Spiros Prantalos Miami the place to be!!
-
Hi everybody I an all the examples that I have studied so far with regards to remoting there is a server and many clients that communicate with it using either TCP/IP or HTTP. What kind of communication protocol can we use for the case of windows forms that communicate with other windows forms and need to pass data to them. So instead of having a pool of sockets to connect, we have the server (window form father) to create and then send data to the new window form (window form child) and then wait until the child window returns some results. If we use TCP/IP and config files all child processes will use the same port. From my small exeprience I believe that this is at least incorrect. So my question is: does anyone know am effective way to perform that type of communication? Thank you very much for your time. Spiros Prantalos Miami the place to be!!
-
Hi everybody I an all the examples that I have studied so far with regards to remoting there is a server and many clients that communicate with it using either TCP/IP or HTTP. What kind of communication protocol can we use for the case of windows forms that communicate with other windows forms and need to pass data to them. So instead of having a pool of sockets to connect, we have the server (window form father) to create and then send data to the new window form (window form child) and then wait until the child window returns some results. If we use TCP/IP and config files all child processes will use the same port. From my small exeprience I believe that this is at least incorrect. So my question is: does anyone know am effective way to perform that type of communication? Thank you very much for your time. Spiros Prantalos Miami the place to be!!
Using a
TcpChannel
is typical for remoting between app domains on the same machine. There is far less overhead than with HTTP (a protocol over TCP/IP). Using a .config file for remoting configuration (by callingRemotingConfiguration.Configure
) does offer benefits over manual configuration, but you can still specify ports. Each application will have it's own configuration file (named yourappname.exe.config) so you can configure clients to use the same or different ports. Of course, applications that need to communicate with each other via remoting must use the same port. Also note that with remoting, you don't have to use the typical client-server setup. Clients can talk to each other as well as can servers; in essence, each application acts as a client and server (sending requests and getting responses back for both applications). You should pick up the book ".NET Remoting" from MSPress. It's a good introduction to remoting and covers lots of intermediate and some advanced techniques and topics.-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
-
Using a
TcpChannel
is typical for remoting between app domains on the same machine. There is far less overhead than with HTTP (a protocol over TCP/IP). Using a .config file for remoting configuration (by callingRemotingConfiguration.Configure
) does offer benefits over manual configuration, but you can still specify ports. Each application will have it's own configuration file (named yourappname.exe.config) so you can configure clients to use the same or different ports. Of course, applications that need to communicate with each other via remoting must use the same port. Also note that with remoting, you don't have to use the typical client-server setup. Clients can talk to each other as well as can servers; in essence, each application acts as a client and server (sending requests and getting responses back for both applications). You should pick up the book ".NET Remoting" from MSPress. It's a good introduction to remoting and covers lots of intermediate and some advanced techniques and topics.-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
Thank you for your help. After some research I found the following: -- Let's assume you have two Windows Forms applications, running on a single machine and you want the two applications to be able to communicate with each other. Or suppose you have a Windows service which should exchange data with your GUI application. Which protocol can you use? Remoting! This is one of the cases where the TCPChannel is extremely helpful as it allows you to specify rejectRemoteRequests="true" upon its construction which limits all incoming connections to the ones originating from your own machine. No need to take too many precautions about security in this case. However: If you use fixed port numbers for WinForms to WinForms communication, you might run into troubles when running on Windows Terminal Services with two or more users trying to use your application at the same time -- Unfortunately this is my case. Spiros Prantalos Miami the place to be!!
-
Thank you for your help. After some research I found the following: -- Let's assume you have two Windows Forms applications, running on a single machine and you want the two applications to be able to communicate with each other. Or suppose you have a Windows service which should exchange data with your GUI application. Which protocol can you use? Remoting! This is one of the cases where the TCPChannel is extremely helpful as it allows you to specify rejectRemoteRequests="true" upon its construction which limits all incoming connections to the ones originating from your own machine. No need to take too many precautions about security in this case. However: If you use fixed port numbers for WinForms to WinForms communication, you might run into troubles when running on Windows Terminal Services with two or more users trying to use your application at the same time -- Unfortunately this is my case. Spiros Prantalos Miami the place to be!!
Okay, sorry, didn't understand quite what you were asking in the first post. You could have a remoting object that merely keeps track of which ports are currently being used by a pair of applications, and perhaps even hands out ports to use. Of course, you'd have to configure the remote objects yourself, but this isn't a difficult thing (just more difficult to change since you have to recompile for some things). If security is an issue, you could assign each user a key (if you have ActiveDirectory with Certificate Services installed and setup, just use the user's key) to communicate between application domains. If you configure the apps to use the same port, of course only the first user would be able to run it. Finally, if you use a client-server type setup, you could use single call well-known objects so that multiple users don't interact with each other's sessions. Just a couple of thoughts.
-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----