Hi to any and all --
I'm trying to build a script to listen on a port, accept an incoming connection, and write the incoming data to a file. I've seen some examples, but am confused by using read or recv. I've also seen something like:
...
while ($new_sock = $sock->accept()) {
while (defined ($buf = <$new_sock>)) {
print $buf; #I would write to output file here
}
}
Is there a "best" way to do this? I want to accept the connection, write data, then go back to listening for another connection.
Thanks in advance!!
Chris Hawkins
I'm trying to build a script to listen on a port, accept an incoming connection, and write the incoming data to a file. I've seen some examples, but am confused by using read or recv. I've also seen something like:
...
while ($new_sock = $sock->accept()) {
while (defined ($buf = <$new_sock>)) {
print $buf; #I would write to output file here
}
}
Is there a "best" way to do this? I want to accept the connection, write data, then go back to listening for another connection.
Thanks in advance!!
Chris Hawkins