The Client Program : Client « Network « Perl

Home
Perl
1.Array
2.CGI
3.Class
4.Data Type
5.Database
6.File
7.GUI
8.Hash
9.Language Basics
10.Network
11.Regular Expression
12.Report
13.Statement
14.String
15.Subroutine
16.System Functions
17.Win32
18.XML
Perl » Network » Client 
The Client Program
    


#!/usr/bin/perl

print "client\n";

$AF_UNIX=1;
$SOCK_STREAM=1;
$PROTOCOL=0;

socket(CLIENTSOCKET, $AF_UNIX, $SOCK_STREAM, $PROTOCOL);
$name="./greetings";

do{
   $result = connect(CLIENTSOCKET, "$name" );
   if ($result != ){
      sleep(1);
   }
}while($result !=  ); # Loop until a connection is made

read(CLIENTSOCKET, $buf, 500);
print STDOUT "$buf\n";
close (CLIENTSOCKET);
exit(0);

   
    
    
    
  
Related examples in the same category
1.Time client
2.Two way client
3.The Client with Socket
4.A Daytime Client
5.Read the first line from a remote server
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.