Anders Branderud
Anders Branderud

Reputation: 1918

Why is listening on port with Netcat not working

I am running the following command on Ubuntu:

nc -l -p 5004 -v  >> /home/anders/Dropbox/netcatFiles/test

which includes a command to make it listen at 5004.

I am sending a RTP-stream to port 5004 using VLC. When I am observing the loopback-interface in Wireshark I notice ICMP-packets with the message 'Destination unreachable'.

Opening another VLC and telling it to play the incoming data at port 5004, it all works, and the stream is played.

What should I do in order to get Netcat to listen at port 5004?

Upvotes: 10

Views: 58996

Answers (2)

LSerni
LSerni

Reputation: 57408

I think you need to add the " -u " parameter to make it listen on UDP.

By default, netcat works in TCP mode, but RTP protocol is UDP based.

"The Transmission Control Protocol (TCP), although standardized for RTP use,[5] is not normally used in RTP application because TCP favors reliability over timeliness. Instead the majority of the RTP implementations are built on the User Datagram Protocol (UDP)"

http://en.wikipedia.org/wiki/Real-time_Transport_Protocol

Upvotes: 13

Harald Brinkhof
Harald Brinkhof

Reputation: 4455

don't use -p (man nc (1))

-p source_port Specifies the source port nc should use, subject to privilege restrictions and availability. It is an error to use this option in con‐ junction with the -l option.

so just specify

nc -l 5004 -v  >> /home/anders/Dropbox/netcatFiles/test

Upvotes: 8

Related Questions