Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

With the telnet program one can connect to any TCP port on any host, but is there a way to listen on some port on current host?

i.e.

1) on host a: telnet listen 12345

2) on host b: telnet host_a 12345

I don't want any service behind the listening side, just connection and whatever typed to be transferred as is both ways.

I know I can already do the 2), but is there any way to achieve the 1)? I'm interested in both Windows and Linux solution.

share|improve this question
    
wireshark (tcpdump)? –  Anders Oct 29 '11 at 23:10
    
@Anders: Nope, that doesn't open the port, and the peer will get its connection refused instead of finishing the 3-way handshake. –  Ben Voigt Oct 30 '11 at 18:35
add comment

7 Answers

The usual tool for this is something called netcat. It's available in most Linux distros, and may even be installed by default in some (the command is nc). There are even ports for Windows, but nearly every antivirus package on the planet considers it deeply suspicious due it's use in malware which makes it hard to download and use.

share|improve this answer
add comment

You are looking for a program called netcat. It is the swiss army knife of network utilities. You can tell it to listen on any arbitrary port as well as many other things.

share|improve this answer
add comment

1) on host a: telnet listen 12345

$ ls | nc -l -p 12345

Depends on the distro and netcat version, you may not need -p option.

2) on host b: telnet host_a 12345

$ telnet host_a 12345
1159.rar
12030.mp4
123.mp4
124.mp4
129
129.bak
...
share|improve this answer
add comment

Netcat, is what you're looking for.

http://netcat.sourceforge.net/

share|improve this answer
add comment

Download Netcat. Swiss army knife of network utilities. http://netcat.sourceforge.net/

share|improve this answer
add comment

Even better than netcat is socat.

It provides a lot more control over socket options, and also many more choices for where to send received data.

share|improve this answer
add comment

Internet Maniac can listen on any TCP and UDP port in Windows world

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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