Here is a very simple client/server example coded in Perl. This is an extremely basic application – the goal was merely for me to learn how to use sockets in Perl. You can check out the code on github here: github.com/darkmuck/SimplePerlSockets.
After you’ve downloaded the client and server files follow these instructions to test it out:
- Open two terminal windows
- From the first terminal, run these commands:
- $ chmod a+x server.pl;perl server.pl 1234;
- From the second terminal, run these commands:
- $ chmod a+x client.pl;perl client.pl localhost 1234
- From the second terminal window (client) try to type any word(s) and press enter. You should see the result transmitted to terminal window #1 (server).