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