versions of netcat

8

1

I've tried the two main versions of netcat : GNU and BSD. (mine is BSD Version).

On GNU version, the command $ nc -l -p 12345 works fine but with BSD, option -l (listen) can't be used in conjonction with -p (local port).

I don't understand why there is a such difference between these two versions ? In the BSD version, when I use option -p, it calls automatically -l (listen) ?

thanks ;-)

Ps: https://bugs.launchpad.net/ubuntu/+source/netcat-openbsd/+bug/590925/comments/3 -p is different between the two. The OpenBSD version uses it to set a source port for remote connections, while the traditional nc uses it to specify the local port on which it will listen when in listen mode.

lilawood

Posted 2011-05-14T22:05:38.113

Reputation:

The Ubuntu packages are netcat-traditional for GNU, and netcat-openbsd and netcat for BSD. – Ciro Santilli 新疆改造中心法轮功六四事件 – 2015-08-28T15:18:48.157

http://askubuntu.com/questions/346869/what-are-the-diffrences-between-netcat-traditional-and-netcat-openbsd – Ciro Santilli 新疆改造中心法轮功六四事件 – 2015-08-28T16:10:20.650

3In the BSD version, -l takes the port to listen on, so -p is not needed at all. I'm not sure what -p does without -l. I don't know why there's a difference. – None – 2011-05-14T22:08:55.223

1Try ncat (in the nmap distro). – William Pursell – 2011-05-14T23:38:13.187

1Try socat, completely different syntax, but way more capabilities than the good old netcat's. – Marcin – 2011-08-18T14:43:56.690

@icktoofay if you move you're comment to answers i'll upvote then vote to close ... just tag me in the post so i see it – RobotHumans – 2011-10-22T01:12:46.597

Answers

4

In the BSD version, -l takes the port to listen on, so -p is not needed at all. I'm not sure what -p does without -l. I don't know why there's a difference. – icktoofay <--credit for the solution goes to that guy...but I don't think he has an account on SU, just SO.

RobotHumans

Posted 2011-05-14T22:05:38.113

Reputation: 5 758