use threads; use SOCKETSVR::Server; my $port = 5188; my $d = new SOCKETSVR::Server LocalPort => $port; print "Socket Server started. port=$port\r\n"; while (my $conn = $d->accept) { # $conn is socket client handler, which is GLOBtype threads->new(\&start_process, $conn)->detach(); undef($conn); } sub start_process { my $conn=shift; if(my $r = $conn->recv_data) { #blabla.... } $conn->close; return; }