Leser: 24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
sub senddata{
my $socket = new IO::Socket::INET (
PeerAddr => $server_ip,
PeerPort => $server_port,
LocalPort => $localport,
Proto => 'tcp',
)
or die "socket ERROR: couldn't connect to server $server_ip:$server_port\n";
my $send_data = "blabla";
$socket->send($send_data);
sleep(1);
$socket->recv($recv_data,1024);
#.... wird hier mehremals senden und empfangen
close $socket;
}
1
2
3
4
5
my $socket = new IO::Socket::INET (
PeerAddr => $server_ip,
PeerPort => $server_port,
Proto => 'tcp',
)