I am using netcat in Linux to send and receive data (using udp protocol) from a serial port to another device through the network. The command is :

nc -u < /dev/ttyUSB0 > /dev/ttyUSB0 

The USB I am using is a USB to serial 485 converter and I am noticing that the receiver light is not blinking at all while the transmit light is blinking.

I checked whether the messages are been sent and received through the network using tcpdump and I could clearly see that it is transferring the data between my machine and the device machine! I am now thinking it might be netcat problem any ideas ?

  • Try using TCP. UDP datagrams can get lost or blocked by a firewall without any error being reported. – wingedsubmariner Nov 27 '13 at 17:23
  • I tried that as well, same problem – user573014 Nov 27 '13 at 18:32

Just throwing this out there..

But control-d can signal end of file, and perhaps your input streams include this character. That would shut down that input stream, while the other might continue working.

While I don't know what happened in your particular situation, I know you can test this via nc on the command line:

#create a server
nc -v -v -l -p 9000      #yes, I was testing xdebug...

-------- in a different terminal:

#create a client
nc localhost 9000

Type something in both. Hit Ctrl-D in one. Now stuff you type in that terminal won't show up, but the stuff you type in the other terminal will still show up.

Caught me by surprise. I thought it had some kind of buffer issue or was half duplex. Found your question before finding the answer.

Oh, and to make sure it doesn't behave this way:

stty eof undef

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.