[caracas-pm] IO:Socket
Alejandro Imass
ait at p2ee.org
Sat Oct 4 07:18:57 PDT 2008
El fin de linea no es \n (CR) sino \n\r (CR+LF)
ASCII HEX DEC OCTAL
CR 0x0D 13 015
LF 0x0A 10 012
Si te quieres curar en salud usa \015\012 como fin de linea.
(a menos que estés trabajando en un EBCDIC y quizás debas usar NEL ;-))
Referencias:
http://es.wikipedia.org/wiki/ASCII
http://es.wikipedia.org/wiki/CRLF
http://www.onlamp.com/pub/a/onlamp/2006/08/17/understanding-newlines.html
http://en.wikipedia.org/wiki/Newline
http://en.wikipedia.org/wiki/EBCDIC
http://www.w3.org/TR/newline
http://www.rfc-editor.org/EOLstory.txt
El vie, 03-10-2008 a las 07:30 -0430, Hans Olzem escribió:
> 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
>
>
More information about the caracas-pm
mailing list