Friday, January 18, 2013
11:00 PM

Perl Script: Simple Network Programming (Client - Server Application)

A network socket is an endpoint of an inter-process communication flow across a computer network. Today, most communication between computers is based on the Internet Protocol; therefore most network sockets are Internet sockets.

In Perl, IO::Socket::INET provides an object interface to creating and using sockets in the AF_INET domain. It is built upon the IO::Socket interface and inherits all the methods defined by IO::Socket.

Below is a simple server created using Perl IO::Socket::INET module

Source: server.pl
#!/usr/bin/perl

use IO::Socket::INET;

$socket = new IO::Socket::INET (
    LocalHost => '127.0.0.1',
    LocalPort => '40000',
    Proto => 'tcp',
    Listen => 10,
    Reuse => 1
) or die "Oops: $! \n";
Continue Reading...

0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.