Simple client / server with nc not working The Next CEO of Stack Overflowwhy ping6 fails if tcpdump shows ICMP6 request/reply traffic?Linux Firewall & sharing files between computers in different subnets connected to single switchKVM Ubuntu Guest cannot connect to the internet on bridged networkingHow to configure dual homed server in order for both network segments to communicate?How to add an static route on google compute engineAWS port unreachable on REHLSet Up Port Listening And ForwardingRoute incoming traffic for host1.example.com:80 to a docker container with port 80 bound to 10080KVM guest can't connect to itself after DNATDuplication of UDP traffic to two ports on localhost
Raspberry pi 3 B with Ubuntu 18.04 server arm64: what pi version
How should I connect my cat5 cable to connectors having an orange-green line?
Is it correct to say moon starry nights?
How dangerous is XSS
Creating a script with console commands
Ising model simulation
How can the PCs determine if an item is a phylactery?
Words hidden in my phone number
What does it mean 'exit 1' for a job status after rclone sync
How do I secure a TV wall mount?
Are British MPs missing the point, with these 'Indicative Votes'?
Is it OK to decorate a log book cover?
Is it possible to create a QR code using text?
Why did early computer designers eschew integers?
Trying to insert a background image via TikZ results in extra white-space around the corners
Traveling with my 5 year old daughter (as the father) without the mother from Germany to Mexico
Do I need to write [sic] when including a quotation with a number less than 10 that isn't written out?
What is the difference between 'contrib' and 'non-free' packages repositories?
Why did the Drakh emissary look so blurred in S04:E11 "Lines of Communication"?
Compensation for working overtime on Saturdays
Is it reasonable to ask other researchers to send me their previous grant applications?
Simplify trigonometric expression using trigonometric identities
Mathematica command that allows it to read my intentions
Is it possible to make a 9x9 table fit within the default margins?
Simple client / server with nc not working
The Next CEO of Stack Overflowwhy ping6 fails if tcpdump shows ICMP6 request/reply traffic?Linux Firewall & sharing files between computers in different subnets connected to single switchKVM Ubuntu Guest cannot connect to the internet on bridged networkingHow to configure dual homed server in order for both network segments to communicate?How to add an static route on google compute engineAWS port unreachable on REHLSet Up Port Listening And ForwardingRoute incoming traffic for host1.example.com:80 to a docker container with port 80 bound to 10080KVM guest can't connect to itself after DNATDuplication of UDP traffic to two ports on localhost
Why is the following not working?
I have a freshly installed Debian 9 system. iptables is wide-open:
[···]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
I log in on two separate consoles (well, two separate ssh logins). In one of them, I run:
[···]# nc -l 11115
Then, I go to the other console, and run:
[···]# nc localhost 11115
and I get a Connection refused error:
[···]# nc localhost 11115
localhost [127.0.0.1] 11115 (?) : Connection refused
I also tried nc 127.0.0.1 11115, tried with telnet --- always Connection refused.
On the "listening" side, I also tried nc -l localhost 11115 --- no difference.
What am I missing or doing wrong?
[EDIT]: On a CentOS 6.9 machine, the exact same commands above work as expected. Same thing on my Ubuntu 14.04 at home. I thought it may be that running as root makes nc disallow some functionality. But no, I just tried as a regular user on the Debian 9 machine, and it fails all the same. Any ideas why?
linux-networking nc
New contributor
Cal-linux is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
Why is the following not working?
I have a freshly installed Debian 9 system. iptables is wide-open:
[···]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
I log in on two separate consoles (well, two separate ssh logins). In one of them, I run:
[···]# nc -l 11115
Then, I go to the other console, and run:
[···]# nc localhost 11115
and I get a Connection refused error:
[···]# nc localhost 11115
localhost [127.0.0.1] 11115 (?) : Connection refused
I also tried nc 127.0.0.1 11115, tried with telnet --- always Connection refused.
On the "listening" side, I also tried nc -l localhost 11115 --- no difference.
What am I missing or doing wrong?
[EDIT]: On a CentOS 6.9 machine, the exact same commands above work as expected. Same thing on my Ubuntu 14.04 at home. I thought it may be that running as root makes nc disallow some functionality. But no, I just tried as a regular user on the Debian 9 machine, and it fails all the same. Any ideas why?
linux-networking nc
New contributor
Cal-linux is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
Why is the following not working?
I have a freshly installed Debian 9 system. iptables is wide-open:
[···]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
I log in on two separate consoles (well, two separate ssh logins). In one of them, I run:
[···]# nc -l 11115
Then, I go to the other console, and run:
[···]# nc localhost 11115
and I get a Connection refused error:
[···]# nc localhost 11115
localhost [127.0.0.1] 11115 (?) : Connection refused
I also tried nc 127.0.0.1 11115, tried with telnet --- always Connection refused.
On the "listening" side, I also tried nc -l localhost 11115 --- no difference.
What am I missing or doing wrong?
[EDIT]: On a CentOS 6.9 machine, the exact same commands above work as expected. Same thing on my Ubuntu 14.04 at home. I thought it may be that running as root makes nc disallow some functionality. But no, I just tried as a regular user on the Debian 9 machine, and it fails all the same. Any ideas why?
linux-networking nc
New contributor
Cal-linux is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Why is the following not working?
I have a freshly installed Debian 9 system. iptables is wide-open:
[···]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
I log in on two separate consoles (well, two separate ssh logins). In one of them, I run:
[···]# nc -l 11115
Then, I go to the other console, and run:
[···]# nc localhost 11115
and I get a Connection refused error:
[···]# nc localhost 11115
localhost [127.0.0.1] 11115 (?) : Connection refused
I also tried nc 127.0.0.1 11115, tried with telnet --- always Connection refused.
On the "listening" side, I also tried nc -l localhost 11115 --- no difference.
What am I missing or doing wrong?
[EDIT]: On a CentOS 6.9 machine, the exact same commands above work as expected. Same thing on my Ubuntu 14.04 at home. I thought it may be that running as root makes nc disallow some functionality. But no, I just tried as a regular user on the Debian 9 machine, and it fails all the same. Any ideas why?
linux-networking nc
linux-networking nc
New contributor
Cal-linux is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Cal-linux is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited yesterday
Cal-linux
New contributor
Cal-linux is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked yesterday
Cal-linuxCal-linux
1134
1134
New contributor
Cal-linux is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Cal-linux is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Cal-linux is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
There are actually three (or more?) distinct programs called nc (netcat) which are forks or rewrites of the same basic program from long ago and far away.
The default in Debian seems to be what it calls netcat-traditional, the ancient original version. I was able to reproduce this problem with netcat-traditional; listening seems very broken. It did not actually bind to a port; I could not see it listening in ss output, nor did I see it attempt to bind when running it under strace.
The other available Debian package is called netcat-openbsd, which is a currently maintained fork of the original netcat by OpenBSD developers. You should find that it works if you install this package (and you can then remove netcat-traditional).
There is yet another netcat package, which is used by Red Hat based systems, developed and maintained by Fyodor of nmap and insecure.org and other developers. It is a complete rewrite from the ground up and uses no traditional netcat or BSD netcat code. It also works properly. Its package name (on Red Hat systems) is nmap-ncat.
Is it considered good etiquette to propose a cry of "shame to the developers/maintainers of netcat-traditional"??!!! :-) Really, people, one thing is that the original implementation was broken, and another thing is reproducing the unintended / non-specified behaviour due to whatever bugs that implementation had! Shame on you, guys!!! (and sorry, Debian, but shame on you as well for choosing an embarrassingly broken package as part of your default!). Bitterly ranting aside, thanks Michael Hampton!
– Cal-linux
yesterday
1
@Cal-linux You can try but it probably won't work. It hasn't been maintained in many years, which is why it has been tagged traditional. It was first released in 1995 and the last release 1.10 was from 2007. The developer, who only used a pseudonym, may well be dead. Who knows?
– Michael Hampton♦
yesterday
add a comment |
On Debian 2 packages netcat and a transitional package , that will refer to
netcat-traditional
root@debian9:~# apt-cache search ^netcat
netcat - TCP/IP swiss army knife -- transitional package
netcat-traditional - TCP/IP swiss army knife
netcat-openbsd - TCP/IP swiss army knife
[../..]
When you run multiple times nc -l 11115 , nc is listening but on a random port ( seem to be random ) .
root@debian9:~# lsof -p $(pidof nc ) | grep LISTEN
nc 12734 root 3u IPv4 11892054 0t0 TCP *:44907 (LISTEN)
In fact you can run nc -l instead of nc -l 11115 , and you will have the same behavior .
YES netcat-traditional is a old software and some simple bug are not fixed ( in your case example, missing the parameter -p PORT for listening .
You can prefer netcat-openbsd , and it will work as you expected .
root@debian9:/# lsof -p $( pidof nc ) | grep LISTEN
nc 2140 root 3u IPv4 29855 0t0 TCP *:11115 (LISTEN)
"in your case example, missing the parameter -p PORT for listening"; Hahahaha, one mystery solved!! In fact, the man page does explicitly say that (it lists two lines under synopsis, one showsnc [options] host port, one showsnc -l -p port [options] ···. However, I must have opened a separate terminal, which then opened on my local Ubuntu 14 machine, which hasnetcat-openbsdand not the traditional one, and the man page explicitly states that "It is an error to use this option [[the -l option]] in conjunction with the -p, -s, or -z options"
– Cal-linux
20 hours ago
add a comment |
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Cal-linux is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f960798%2fsimple-client-server-with-nc-not-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
There are actually three (or more?) distinct programs called nc (netcat) which are forks or rewrites of the same basic program from long ago and far away.
The default in Debian seems to be what it calls netcat-traditional, the ancient original version. I was able to reproduce this problem with netcat-traditional; listening seems very broken. It did not actually bind to a port; I could not see it listening in ss output, nor did I see it attempt to bind when running it under strace.
The other available Debian package is called netcat-openbsd, which is a currently maintained fork of the original netcat by OpenBSD developers. You should find that it works if you install this package (and you can then remove netcat-traditional).
There is yet another netcat package, which is used by Red Hat based systems, developed and maintained by Fyodor of nmap and insecure.org and other developers. It is a complete rewrite from the ground up and uses no traditional netcat or BSD netcat code. It also works properly. Its package name (on Red Hat systems) is nmap-ncat.
Is it considered good etiquette to propose a cry of "shame to the developers/maintainers of netcat-traditional"??!!! :-) Really, people, one thing is that the original implementation was broken, and another thing is reproducing the unintended / non-specified behaviour due to whatever bugs that implementation had! Shame on you, guys!!! (and sorry, Debian, but shame on you as well for choosing an embarrassingly broken package as part of your default!). Bitterly ranting aside, thanks Michael Hampton!
– Cal-linux
yesterday
1
@Cal-linux You can try but it probably won't work. It hasn't been maintained in many years, which is why it has been tagged traditional. It was first released in 1995 and the last release 1.10 was from 2007. The developer, who only used a pseudonym, may well be dead. Who knows?
– Michael Hampton♦
yesterday
add a comment |
There are actually three (or more?) distinct programs called nc (netcat) which are forks or rewrites of the same basic program from long ago and far away.
The default in Debian seems to be what it calls netcat-traditional, the ancient original version. I was able to reproduce this problem with netcat-traditional; listening seems very broken. It did not actually bind to a port; I could not see it listening in ss output, nor did I see it attempt to bind when running it under strace.
The other available Debian package is called netcat-openbsd, which is a currently maintained fork of the original netcat by OpenBSD developers. You should find that it works if you install this package (and you can then remove netcat-traditional).
There is yet another netcat package, which is used by Red Hat based systems, developed and maintained by Fyodor of nmap and insecure.org and other developers. It is a complete rewrite from the ground up and uses no traditional netcat or BSD netcat code. It also works properly. Its package name (on Red Hat systems) is nmap-ncat.
Is it considered good etiquette to propose a cry of "shame to the developers/maintainers of netcat-traditional"??!!! :-) Really, people, one thing is that the original implementation was broken, and another thing is reproducing the unintended / non-specified behaviour due to whatever bugs that implementation had! Shame on you, guys!!! (and sorry, Debian, but shame on you as well for choosing an embarrassingly broken package as part of your default!). Bitterly ranting aside, thanks Michael Hampton!
– Cal-linux
yesterday
1
@Cal-linux You can try but it probably won't work. It hasn't been maintained in many years, which is why it has been tagged traditional. It was first released in 1995 and the last release 1.10 was from 2007. The developer, who only used a pseudonym, may well be dead. Who knows?
– Michael Hampton♦
yesterday
add a comment |
There are actually three (or more?) distinct programs called nc (netcat) which are forks or rewrites of the same basic program from long ago and far away.
The default in Debian seems to be what it calls netcat-traditional, the ancient original version. I was able to reproduce this problem with netcat-traditional; listening seems very broken. It did not actually bind to a port; I could not see it listening in ss output, nor did I see it attempt to bind when running it under strace.
The other available Debian package is called netcat-openbsd, which is a currently maintained fork of the original netcat by OpenBSD developers. You should find that it works if you install this package (and you can then remove netcat-traditional).
There is yet another netcat package, which is used by Red Hat based systems, developed and maintained by Fyodor of nmap and insecure.org and other developers. It is a complete rewrite from the ground up and uses no traditional netcat or BSD netcat code. It also works properly. Its package name (on Red Hat systems) is nmap-ncat.
There are actually three (or more?) distinct programs called nc (netcat) which are forks or rewrites of the same basic program from long ago and far away.
The default in Debian seems to be what it calls netcat-traditional, the ancient original version. I was able to reproduce this problem with netcat-traditional; listening seems very broken. It did not actually bind to a port; I could not see it listening in ss output, nor did I see it attempt to bind when running it under strace.
The other available Debian package is called netcat-openbsd, which is a currently maintained fork of the original netcat by OpenBSD developers. You should find that it works if you install this package (and you can then remove netcat-traditional).
There is yet another netcat package, which is used by Red Hat based systems, developed and maintained by Fyodor of nmap and insecure.org and other developers. It is a complete rewrite from the ground up and uses no traditional netcat or BSD netcat code. It also works properly. Its package name (on Red Hat systems) is nmap-ncat.
answered yesterday
Michael Hampton♦Michael Hampton
174k27319643
174k27319643
Is it considered good etiquette to propose a cry of "shame to the developers/maintainers of netcat-traditional"??!!! :-) Really, people, one thing is that the original implementation was broken, and another thing is reproducing the unintended / non-specified behaviour due to whatever bugs that implementation had! Shame on you, guys!!! (and sorry, Debian, but shame on you as well for choosing an embarrassingly broken package as part of your default!). Bitterly ranting aside, thanks Michael Hampton!
– Cal-linux
yesterday
1
@Cal-linux You can try but it probably won't work. It hasn't been maintained in many years, which is why it has been tagged traditional. It was first released in 1995 and the last release 1.10 was from 2007. The developer, who only used a pseudonym, may well be dead. Who knows?
– Michael Hampton♦
yesterday
add a comment |
Is it considered good etiquette to propose a cry of "shame to the developers/maintainers of netcat-traditional"??!!! :-) Really, people, one thing is that the original implementation was broken, and another thing is reproducing the unintended / non-specified behaviour due to whatever bugs that implementation had! Shame on you, guys!!! (and sorry, Debian, but shame on you as well for choosing an embarrassingly broken package as part of your default!). Bitterly ranting aside, thanks Michael Hampton!
– Cal-linux
yesterday
1
@Cal-linux You can try but it probably won't work. It hasn't been maintained in many years, which is why it has been tagged traditional. It was first released in 1995 and the last release 1.10 was from 2007. The developer, who only used a pseudonym, may well be dead. Who knows?
– Michael Hampton♦
yesterday
Is it considered good etiquette to propose a cry of "shame to the developers/maintainers of netcat-traditional"??!!! :-) Really, people, one thing is that the original implementation was broken, and another thing is reproducing the unintended / non-specified behaviour due to whatever bugs that implementation had! Shame on you, guys!!! (and sorry, Debian, but shame on you as well for choosing an embarrassingly broken package as part of your default!). Bitterly ranting aside, thanks Michael Hampton!
– Cal-linux
yesterday
Is it considered good etiquette to propose a cry of "shame to the developers/maintainers of netcat-traditional"??!!! :-) Really, people, one thing is that the original implementation was broken, and another thing is reproducing the unintended / non-specified behaviour due to whatever bugs that implementation had! Shame on you, guys!!! (and sorry, Debian, but shame on you as well for choosing an embarrassingly broken package as part of your default!). Bitterly ranting aside, thanks Michael Hampton!
– Cal-linux
yesterday
1
1
@Cal-linux You can try but it probably won't work. It hasn't been maintained in many years, which is why it has been tagged traditional. It was first released in 1995 and the last release 1.10 was from 2007. The developer, who only used a pseudonym, may well be dead. Who knows?
– Michael Hampton♦
yesterday
@Cal-linux You can try but it probably won't work. It hasn't been maintained in many years, which is why it has been tagged traditional. It was first released in 1995 and the last release 1.10 was from 2007. The developer, who only used a pseudonym, may well be dead. Who knows?
– Michael Hampton♦
yesterday
add a comment |
On Debian 2 packages netcat and a transitional package , that will refer to
netcat-traditional
root@debian9:~# apt-cache search ^netcat
netcat - TCP/IP swiss army knife -- transitional package
netcat-traditional - TCP/IP swiss army knife
netcat-openbsd - TCP/IP swiss army knife
[../..]
When you run multiple times nc -l 11115 , nc is listening but on a random port ( seem to be random ) .
root@debian9:~# lsof -p $(pidof nc ) | grep LISTEN
nc 12734 root 3u IPv4 11892054 0t0 TCP *:44907 (LISTEN)
In fact you can run nc -l instead of nc -l 11115 , and you will have the same behavior .
YES netcat-traditional is a old software and some simple bug are not fixed ( in your case example, missing the parameter -p PORT for listening .
You can prefer netcat-openbsd , and it will work as you expected .
root@debian9:/# lsof -p $( pidof nc ) | grep LISTEN
nc 2140 root 3u IPv4 29855 0t0 TCP *:11115 (LISTEN)
"in your case example, missing the parameter -p PORT for listening"; Hahahaha, one mystery solved!! In fact, the man page does explicitly say that (it lists two lines under synopsis, one showsnc [options] host port, one showsnc -l -p port [options] ···. However, I must have opened a separate terminal, which then opened on my local Ubuntu 14 machine, which hasnetcat-openbsdand not the traditional one, and the man page explicitly states that "It is an error to use this option [[the -l option]] in conjunction with the -p, -s, or -z options"
– Cal-linux
20 hours ago
add a comment |
On Debian 2 packages netcat and a transitional package , that will refer to
netcat-traditional
root@debian9:~# apt-cache search ^netcat
netcat - TCP/IP swiss army knife -- transitional package
netcat-traditional - TCP/IP swiss army knife
netcat-openbsd - TCP/IP swiss army knife
[../..]
When you run multiple times nc -l 11115 , nc is listening but on a random port ( seem to be random ) .
root@debian9:~# lsof -p $(pidof nc ) | grep LISTEN
nc 12734 root 3u IPv4 11892054 0t0 TCP *:44907 (LISTEN)
In fact you can run nc -l instead of nc -l 11115 , and you will have the same behavior .
YES netcat-traditional is a old software and some simple bug are not fixed ( in your case example, missing the parameter -p PORT for listening .
You can prefer netcat-openbsd , and it will work as you expected .
root@debian9:/# lsof -p $( pidof nc ) | grep LISTEN
nc 2140 root 3u IPv4 29855 0t0 TCP *:11115 (LISTEN)
"in your case example, missing the parameter -p PORT for listening"; Hahahaha, one mystery solved!! In fact, the man page does explicitly say that (it lists two lines under synopsis, one showsnc [options] host port, one showsnc -l -p port [options] ···. However, I must have opened a separate terminal, which then opened on my local Ubuntu 14 machine, which hasnetcat-openbsdand not the traditional one, and the man page explicitly states that "It is an error to use this option [[the -l option]] in conjunction with the -p, -s, or -z options"
– Cal-linux
20 hours ago
add a comment |
On Debian 2 packages netcat and a transitional package , that will refer to
netcat-traditional
root@debian9:~# apt-cache search ^netcat
netcat - TCP/IP swiss army knife -- transitional package
netcat-traditional - TCP/IP swiss army knife
netcat-openbsd - TCP/IP swiss army knife
[../..]
When you run multiple times nc -l 11115 , nc is listening but on a random port ( seem to be random ) .
root@debian9:~# lsof -p $(pidof nc ) | grep LISTEN
nc 12734 root 3u IPv4 11892054 0t0 TCP *:44907 (LISTEN)
In fact you can run nc -l instead of nc -l 11115 , and you will have the same behavior .
YES netcat-traditional is a old software and some simple bug are not fixed ( in your case example, missing the parameter -p PORT for listening .
You can prefer netcat-openbsd , and it will work as you expected .
root@debian9:/# lsof -p $( pidof nc ) | grep LISTEN
nc 2140 root 3u IPv4 29855 0t0 TCP *:11115 (LISTEN)
On Debian 2 packages netcat and a transitional package , that will refer to
netcat-traditional
root@debian9:~# apt-cache search ^netcat
netcat - TCP/IP swiss army knife -- transitional package
netcat-traditional - TCP/IP swiss army knife
netcat-openbsd - TCP/IP swiss army knife
[../..]
When you run multiple times nc -l 11115 , nc is listening but on a random port ( seem to be random ) .
root@debian9:~# lsof -p $(pidof nc ) | grep LISTEN
nc 12734 root 3u IPv4 11892054 0t0 TCP *:44907 (LISTEN)
In fact you can run nc -l instead of nc -l 11115 , and you will have the same behavior .
YES netcat-traditional is a old software and some simple bug are not fixed ( in your case example, missing the parameter -p PORT for listening .
You can prefer netcat-openbsd , and it will work as you expected .
root@debian9:/# lsof -p $( pidof nc ) | grep LISTEN
nc 2140 root 3u IPv4 29855 0t0 TCP *:11115 (LISTEN)
answered yesterday
EchoMike444EchoMike444
1893
1893
"in your case example, missing the parameter -p PORT for listening"; Hahahaha, one mystery solved!! In fact, the man page does explicitly say that (it lists two lines under synopsis, one showsnc [options] host port, one showsnc -l -p port [options] ···. However, I must have opened a separate terminal, which then opened on my local Ubuntu 14 machine, which hasnetcat-openbsdand not the traditional one, and the man page explicitly states that "It is an error to use this option [[the -l option]] in conjunction with the -p, -s, or -z options"
– Cal-linux
20 hours ago
add a comment |
"in your case example, missing the parameter -p PORT for listening"; Hahahaha, one mystery solved!! In fact, the man page does explicitly say that (it lists two lines under synopsis, one showsnc [options] host port, one showsnc -l -p port [options] ···. However, I must have opened a separate terminal, which then opened on my local Ubuntu 14 machine, which hasnetcat-openbsdand not the traditional one, and the man page explicitly states that "It is an error to use this option [[the -l option]] in conjunction with the -p, -s, or -z options"
– Cal-linux
20 hours ago
"in your case example, missing the parameter -p PORT for listening"; Hahahaha, one mystery solved!! In fact, the man page does explicitly say that (it lists two lines under synopsis, one shows
nc [options] host port, one shows nc -l -p port [options] ···. However, I must have opened a separate terminal, which then opened on my local Ubuntu 14 machine, which has netcat-openbsd and not the traditional one, and the man page explicitly states that "It is an error to use this option [[the -l option]] in conjunction with the -p, -s, or -z options"– Cal-linux
20 hours ago
"in your case example, missing the parameter -p PORT for listening"; Hahahaha, one mystery solved!! In fact, the man page does explicitly say that (it lists two lines under synopsis, one shows
nc [options] host port, one shows nc -l -p port [options] ···. However, I must have opened a separate terminal, which then opened on my local Ubuntu 14 machine, which has netcat-openbsd and not the traditional one, and the man page explicitly states that "It is an error to use this option [[the -l option]] in conjunction with the -p, -s, or -z options"– Cal-linux
20 hours ago
add a comment |
Cal-linux is a new contributor. Be nice, and check out our Code of Conduct.
Cal-linux is a new contributor. Be nice, and check out our Code of Conduct.
Cal-linux is a new contributor. Be nice, and check out our Code of Conduct.
Cal-linux is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f960798%2fsimple-client-server-with-nc-not-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
