Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Networking Question

Networking Question

Scheduled Pinned Locked Moved C#
questionwinformssysadmin
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Spiros
    wrote on last edited by
    #1

    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!!

    S H 2 Replies Last reply
    0
    • S Spiros

      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!!

      S Offline
      S Offline
      Spiros
      wrote on last edited by
      #2

      The whole application runs on Window Terminal Server Spiros Prantalos Miami the place to be!!

      1 Reply Last reply
      0
      • S Spiros

        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!!

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        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 calling RemotingConfiguration.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-----

        S 1 Reply Last reply
        0
        • H Heath Stewart

          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 calling RemotingConfiguration.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-----

          S Offline
          S Offline
          Spiros
          wrote on last edited by
          #4

          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!!

          H 1 Reply Last reply
          0
          • S Spiros

            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!!

            H Offline
            H Offline
            Heath Stewart
            wrote on last edited by
            #5

            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-----

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups