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. Serialport from a remote server

Serialport from a remote server

Scheduled Pinned Locked Moved C#
sysadmincsharpquestion
6 Posts 3 Posters 3 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.
  • G Offline
    G Offline
    grmihel2
    wrote on last edited by
    #1

    Hi guys, I'm playing with some kind of SMS service which should be automated, and I have already developed an application, which can send AT codes to a device through the Serial port COMx. Now I want to expand that application a bit, so I from a desktop can send commands to the serial device on the server. So PC1 can access Server1 (with serial device connected to com1) provided they are connected in same network. Is it possible to make some C# code in a desktop application, which connect to a serialport on another machine? In this case the remote server. And how?

    L 1 Reply Last reply
    0
    • G grmihel2

      Hi guys, I'm playing with some kind of SMS service which should be automated, and I have already developed an application, which can send AT codes to a device through the Serial port COMx. Now I want to expand that application a bit, so I from a desktop can send commands to the serial device on the server. So PC1 can access Server1 (with serial device connected to com1) provided they are connected in same network. Is it possible to make some C# code in a desktop application, which connect to a serialport on another machine? In this case the remote server. And how?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      grmihel2 wrote:

      Is it possible to make some C# code in a desktop application, which connect to a serialport on another machine? In this case the remote server.

      I don't think it is possible to connect directly to another PC's serial port via a lan connection. You will probably need some program on the server that takes commands from your client PC and forwards them to the COM port.

      It's time for a new signature.

      G 1 Reply Last reply
      0
      • L Lost User

        grmihel2 wrote:

        Is it possible to make some C# code in a desktop application, which connect to a serialport on another machine? In this case the remote server.

        I don't think it is possible to connect directly to another PC's serial port via a lan connection. You will probably need some program on the server that takes commands from your client PC and forwards them to the COM port.

        It's time for a new signature.

        G Offline
        G Offline
        grmihel2
        wrote on last edited by
        #3

        I'm affraid that you are right about that. I ended up with using a web service hosted on the com hosted server, and then call the get HTTP request needed in URL form to send message. Using webBrowser object in my desktop application (without opening it visually ofc), and it seems to work this way. Then there is just a request about keep the webhosting service running on the server.

        D 1 Reply Last reply
        0
        • G grmihel2

          I'm affraid that you are right about that. I ended up with using a web service hosted on the com hosted server, and then call the get HTTP request needed in URL form to send message. Using webBrowser object in my desktop application (without opening it visually ofc), and it seems to work this way. Then there is just a request about keep the webhosting service running on the server.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          The other question is does it work with multiple clients at the same time??

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008
          But no longer in 2009...

          G 1 Reply Last reply
          0
          • D Dave Kreskowiak

            The other question is does it work with multiple clients at the same time??

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008
            But no longer in 2009...

            G Offline
            G Offline
            grmihel2
            wrote on last edited by
            #5

            I doubt that the webpage request from the server is thread safe. Since its an sms service, it will overflow the GSM modem with AT commands, if there isn't a short sleep timer. But in my case it doesn't matter, since there is no concurrency problem in this case, which means there is only one person at time sending commands by using this service.

            D 1 Reply Last reply
            0
            • G grmihel2

              I doubt that the webpage request from the server is thread safe. Since its an sms service, it will overflow the GSM modem with AT commands, if there isn't a short sleep timer. But in my case it doesn't matter, since there is no concurrency problem in this case, which means there is only one person at time sending commands by using this service.

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              No, it's not. That's the point of the question. If you had more than one person hitting the service at the same time, one instance would get access to the serial port and the other would throw an exception that the port is busy. The question is how does your service code handle that little problem.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007, 2008
              But no longer in 2009...

              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