Thread Problem mit Socket Server, reagiert zu langsam (7 answers)
Opened by Carsten at 2010-06-06 23:29

esskar
 2010-06-07 22:06
#138068 #138068
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
while(my $new_sock = $sock->accept())
{
     my $buffer;
     my $len = read $new_sock, $buffer, 4096;
     for(;;) {
        if(defined $len) {
           last unless $len;
           print "Read $len chars\n";
           print "Data [" . substr($data, 0, $len) ."]\n";
        }
        else {
           warn "An error occured while reading: $!\n";
           last;
        }
        $len = read $new_sock, $buffer, 4096;
     }
}

View full thread Problem mit Socket Server, reagiert zu langsam