The UDP - must listen on port. The TCP - must connect to a server.

I tried netcat and socat.

nc -v -u -l -p 3333 | nc -v 50000

socat -v UDP-LISTEN:3333,fork TCP:localhost:50000

Both work -- they delivered the message -- but the line is not ended. VLC will only take the command if I close netcat/socat.

I monitored the connection with sockettest and the messages are one after another in the same line, like this:


I need the line to be ended so that the message transmitted looks like this:


Maybe the packet is not ended?

I am wondering if nc or socat have options to send the packet/end line after a certain amount of time.

If I add \n to the output as suggested by @roaima, I get play\nstop\nplay\n on a single line.

  • How are you sending the command to the bridge? Is there any reason you cannot include the \n in the data that you send? – roaima Mar 2 '16 at 16:10

I suspect your problem is more because whatever sends the UDP packets is not adding a newline character the commands (as in they should send "play\n" and not just "play").

In any case, if you want a new TCP connection to be created for each of the UDP packets, you should use udp-recvfrom instead of udp-listen in socat:

socat -u udp-recvfrom:3333,fork tcp:localhost:50000

Then every UDP packet should trigger one TCP connection that is only brought up to send the content of the packet and then closed.

Test by doing:

echo play | socat -u - udp-sendto:localhost:3333

(which sends a UDP packet whose payload contains the 5 bytes "play\n").

  • thank for response, these commands are send via a playout program Playbox Airbox. is a profesional playout program for broadcasting. and u are right if i write play\n i get exactly that play\nstop\nplay\n its sending the text disregarding the \n , udp-recvfrom works like a charm thank you ! – Mihai Popescu Mar 2 '16 at 21:11

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.