Hi All,

 I am trying to write a client SOCKET programming and I want to capture the
response from Server. The scenario is if I tried the username and password,
which you can see below, the server response with ACK and timestamp.
 
I want to capture the timestamp, could somebody tell me how can I do that?

$ telnet 102.120.64.101 3010
Trying...
Connected to 102.120.64.101
Escape character is '^]'.
kewl,blue27;                        <-- Username and password 
ACKNOWLEDGE,STAMP=2006100510374109;  <<-- Response from Server 

And here is my code:

my ( $file ) = @_;
 my $sock = new IO::Socket::INET ( PeerAddr => '102.120.64.101', PeerPort =>
'3010', Proto => 'tcp' );
 $sock->autoflush(1);
 die "Could not create socket: $!\n" unless $sock;
 my $line;
 open FOUT, ">>message.log";
 open FILE, "$file";
 print $sock 'kewl,blue27;';
 $result=<$sock>;        # << seems not working :(
 print "The response is : $result";
 print STDOUT "The response is : $result\n";
 close FILE;
 close FOUT;
 close($sock);

Could somebody tell me what is wrong with my code?      

Regards,
Joseph

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to