Leser: 1
|< 1 2 3 >| | 27 Einträge, 3 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use strict;
use IO::Socket;
use IO::Socket::INET;
my $CRLF = chr(13).chr(10);
use constant SERVER_PORT => 40411;
my $sock = IO::Socket::INET->new(PeerHost => 'localhost', PeerPort => SERVER_PORT, Proto => 'tcp');
if($sock->connected)
{
print "KARAMBA\n";
my $request = "";
my $response = "";
while(lc($request) ne "quit" and lc($response) ne "quit")
{
print "Eingabe: "\n";
$request = <STDIN>;
chomp $request;
$sock->write("$request$CRLF", length($request)+2);
print "YOU wrote: [$request]\n";
$response = $sock->getline();
chomp $response;
$response =~ s!$CRLF$!!g; # to be sure
print "SERVER wrote: [$response]\n";
}
}
|< 1 2 3 >| | 27 Einträge, 3 Seiten |