[caracas-pm] IO:Socket

Hans Olzem holzem at cantv.net
Fri Oct 3 05:00:59 PDT 2008


Hola mongers,

programe un cliente:


	#!/usr/local/bin/perl -w
	use Tk;
	use IO::Socket;
	use Tk::Button;
	use integer;
	use strict;
	use constant TIMEOUT => 5;

	my $host = 'localhost';
	my $port = '12345';

 	$sock = new IO::Socket::INET(	PeerAddr => $host,
                 		PeerPort => $port,
                		Proto    => 'tcp', Timeout => TIMEOUT)
	    or die "can't connect to $host:$port: $@\n";

	$Cmdstrng = "GO\n";
	print $sock $Cmdstrng;


	MainLoop;


#Asi mando commandos al servidor:

	$Cmdstrng = "SET 1 GA 1 1 1 -1\n";
	print $sock $Cmdstrng;


# Hay commandos a los cuales el servidor responde con informacion:

	$Cmdstrng = "GET 3 FB 32\n";
	print $sock $Cmdstrng;

$server_response = ???????????;


#Ahora la pregunta: Como tengo accesso a esta repuesta del servidor?
#Con telnet funciona bien.


Hans


-- 
Hans Olzem <holzem at cantv.net>


More information about the caracas-pm mailing list