0

I have a real serial port COM1 on PC, plus some USB serial ports. I would like to send and receive data using TCP/IP/UDP api, but not serial api (such as open the file, or C# serial api).

I plan to create virtual network interface and write some service to divert the communication packets to serial ports. How do I achieve this on Windows, or Linux? Is it a driver? or can it be done in user space? My plan is to set a designated IP address, and use port 0 (or specify one) for configuration, such as listing available serial ports, and open, close, set baud rate... and use other ports to communicate to them.

I know someone will mention PPP, but don't. That requires a TCP/IP stack on the other side. I want to talk to a real serial device on the other side.

3
  • You will need to find an adapter of some kind that does it, which puts this question off-topic. Commented Aug 2, 2015 at 2:21
  • @EJP I am looking a pure software implementation, not some adapter hardware. What you implied is that it needs a driver, that is one info. Commented Aug 2, 2015 at 2:44
  • I did not mean a hardware device and I did not imply anything about a driver. Still off topic. Commented Aug 2, 2015 at 18:59

1 Answer 1

1

I'm not entirely sure I understood your question correctly, so this might be wrong. But it seems to me that you need a regular user space TCP/IP server on the machine with the COM port.

The server would bind to any IP address you give it (you can create your own virtual interface of it if you want) and give clients access to the COM port using some protocol you'll implement over the socket. You can have the server listen on multiple ports - some for configuration, some for data.

Here's a sketch:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.