Da hast du einen Link zu IO::Socket:
http://search.cpan.org/~gbarr/IO-1.2301/IO/Socket....
und ja, es kann in beide Richtungen.
Eine kleines Script, was sich zu nem Server verbindet und mittels Select Daten holt:
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
sub main_connection {
my $text = shift;#prompt-msg
sleep(30) unless $FST;#provide serverflooding
$FST = 0;
print "$text\n";
$SPIN = shake_hands();
login();
#use select to have a non-blocking socket
my $sock = new IO::Select( $SPIN );
main_loop($sock);
} #sub main_connection
sub main_loop {
my $sock = shift;
my $died = 0;#check flag
while (1) {
#get data from socket, if there some
while ((my @ready = $sock->can_read(30))) {
#print "test1\n";
for my $fh (@ready) {#checkout readable fhs
if($fh == $SPIN) {
my $input;
unless(sysread($SPIN,$input,2048)) { $died = 1 };
last if $died;
if($input) {
#print "test2\n";
ping_check();
#in some cases we've more than one cmd in a line
#so we've to split them by \n, cause server seperates by \n
my @cmds = split /\n/, $input;
for my $line (@cmds) {
open_log() unless check_log("logs/$logfile");
start($line);
#print "test3\n";
}
} else {
print "unknow socketerror...\n";#syswrite returns 1, but we haven't some input?
}
last;
}
}
last if $died;
}
last if $died;
ping_check() or last;
print "Nichts passiert!\n";
}
main_connection('Socketerror, trying to reconnect..');
} #main_loop()
$SPIN ist eine Instanz von IO::Socket
mit
print $SPIN "Data\n";
kannst du dem Server Daten uebermitteln
MfG
edit: fuer die leerzeilen kann ich nichts
Pörl.