Listen on port – client server demo


You want to listen on a port, maybe to test firewalls! 🙂

Excellent introduction to client server software.



Another use bit of socket programming, courtesy of Perl! 🙂

Extremely useful bit of Perl, which can be used with the other post on this site, to confirm network connectivity (port scanner).

This code (see example tab) will listen on a port (although be careful it is over 1024, unless you are running as root/admin).



perl -MIO::Socket -e '$srv=IO::Socket::INET->

or die "Failed trying to listen on $ARGV[0]n";while($cl=$srv->accept()) { while() { print }

} close($socket);' port

Can also use it as a cheap chat service! 🙂 Everything gets echo’d through – so just telnet host port and type away! 🙂

Also see my port scan code at the reference tab.



[tags]Perl Socket Programming, Network Programming, Perl Port Listen, Perl Client Server demo, Perl Coding School[/tags]


If you have found my website useful, please consider buying me a coffee below 😉

Leave a Reply

Your email address will not be published. Required fields are marked *