Socket server : Socket « Network « Perl






Socket server

    

use IO::Socket;

$server = IO::Socket::INET->new
(
    LocalPort => 1116,
    Type      => SOCK_STREAM,
    Reuse     => 1,
    Listen    => 5 
) or die "Could not open port.\n";

while ($client = $server->accept()) {

    $line = <$client>;

    print $line;

}

close($server);

   
    
    
    
  








Related examples in the same category

1.Time Server with Socket
2.Using Socket to call a Perl CGI
3.Perl Modules for Networking with Sockets
4.Open a socket
5.Post query to a CGI
6.Query a Perl CGI
7.Listen to a port
8.Using regular expresion to validate an IP address
9.Child handle and parent handle
10.Daytime client, using symbolic host and service names
11.Add a host, delete a host, add a user, delete a user, ping a host, list processes, list filesystems, lists hosts, and kill a process.
12.A Perl TCP server without the Socket module.
13.A Simple script to update your host/ip with dyndns.org service.