while ($new_sock = $listener->accept()) #now you just stuck in this loop { while (defined ($buf = <$new_sock>)) #where do you reply to your client, start from the second client? { print FILE "$buf"; } close FILE; }