Click here to Skip to main content
15,790,022 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello All,
I want to write program using C# and WPF, sending data from RS232 to multiple TcpClients using TcpServer , can any one suggest references or tutorials or books , am new to this networking topic. thanks in advance

I agree with Wes Aday (Solution 1).

In the industry world, there is quite a common practice to have slaves of any kind connected to a PC or a PLC. Each Slave is optimized to use one comunication protocol (CAN, MPI, PPI, Profibus, Profinet, TCP/IP...). The PLCs have different built-in interfaces that can be configured in one or another of those protocols, but once you configure which protocol are you going to use... You are stuck with it for that port / interface. If you need to connect several elements that use a different protocol you need to use a Slave-Master to translate from one to another.

And I also agree with Andy411, the RS232 is the type of connector, not the protocol. You can run different types of transmision through the same cable. I just use one serial and one ethernet cable (and sometimes one adapter to make the serial Null-Modem) at work.

In conclusion, I don't see any solution for you without using intermediate Hardware
Take a look to solution 5. Computers really can do it, Espen Harlinn pointed it out. Check the links he provided you
Share this answer
VJ Reddy 19-Apr-12 20:05pm    
Good answer. 5!
Nelek 20-Apr-12 16:36pm    
Thank you VJ
One of the standard ways to do tcp/ip over the serial port is documented in rfc1055[^] also known as SLIP[^].

Serial Line Internet Protocol (SLIP) option is not available in Windows 7, but you can use Windows XP mode for SLIP connections.

TCP/IP Sockets in C#: Practical Guide for Programmers[^] provides a nice introduction to TCP/IP development for .Net

Best regards
Espen Harlinn
Share this answer
[no name] 18-Apr-12 17:50pm    
+5 for pulling that out
Espen Harlinn 18-Apr-12 17:58pm    
Thanks Wes, I used slip about 20 years ago to access the internet using a dial-up connection...
[no name] 18-Apr-12 19:13pm    
Well you know... I've slept since then. Totally purged from memory.
Espen Harlinn 20-Apr-12 2:41am    
VJ Reddy 19-Apr-12 20:05pm    
Nice answer. +5
I am afraid that you are not going to find anything that will help you to use RS232 to communicate with TCP clients. You see... AFAIK it can't be done I'll be darned, I guess you can.

You use the RS232 to communicate with other devices that are also using RS232. Generally uses a serial port.

You use TCP/IP (the P is a big hint, P = protocol) to communicate with other devices that are also using TCP/IP. You can't mix the two. Generally uses an RJ485 port.

You can get specialized devices that will translate RS232 to TCP but you are still communicating RS232.
Share this answer
Nelek 18-Apr-12 16:56pm    
OP answered to you into a solution, this is the text:
Thank you for your quick answer, i will also search if there is any solution
VJ Reddy 19-Apr-12 20:05pm    
Good answer. +5
[no name] 19-Apr-12 23:14pm    
I guess you read data via RS232 from a device and you want to make this data available over network to other applications.

So you want to carry this data via TCP/IP to one or more clients.

You need something to read the data from the serialport stream and copy it into the socket stream.

Take a look at

SerialPort Class[^]

TcpClient Class[^]

BTW: AFAIK RS232 desribes the physical layer RS 232[^]

Even if both P in TCP/IP stand for protocol you can use this protocols to carry another protocol, e.g. http. TCP/IP is suitable for all kind of point to point communication in a IP based network.
Share this answer
You can use a protocol like PPP or SLIP.
Both of these protocols were used to encapsulate TCP/IP over a long distance serial feed and were common place in the early dial-up modem internet days.
If you only have 2 wires over a longer distance than TCP/IP can go without power, say like on a long boat, then, you may be able to fool twin/dual dial-up modems to handshake over those wires like they would over a normal POTS system. It won't be fast however, it should work in theory.
Another option would be to use RS-422 if you have 4 wires (2x differential pairs of wires) for full duplex communications and some sort of (PPP,CSLIP,SLIP) program.
I am unsure if this could be achieved over RS-485 being half-duplex.
It may! I have never tried.
It is very interesting!
RS485 can cover 1.2km in distance over twin wires. Far outside the range of Ethernet cables without a repeater. I do not know of any device that will enable the TCP/IP discovery over long-reach serial other than the PPP/CSLIP types.
That's all I have.
Share this answer
OriginalGriff 3-Sep-21 1:52am    
Reason for my vote of one: While I applaud your urge to help people, it's a good idea to stick to new questions, rather than 9 year old ones. After that amount of time, it's unlikely that the original poster is at all interested in the problem any more!
Answering old questions can be seen as rep-point hunting, which is a form of site abuse. The more trigger happy amongst us will start the process of banning you from the site if you aren't careful. Stick to new questions and you'll be fine.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900