Simple Perl Clientserver Sockets Example

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:

  1. Open two terminal windows
  2. From the first terminal, run these commands:
    1. $ chmod a+x server.pl;perl server.pl 1234;
  3. From the second terminal, run these commands:
    1. $ chmod a+x client.pl;perl client.pl localhost 1234
  4. 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).
Written on March 17, 2012