http://qs321.pair.com?node_id=322526


in reply to Re: Transmit file over socket
in thread Transmit file over socket

I will look into this - thank you. However, for the first file the filename and size are seperate (which is what I was looking for.. only for the second and following files that get processed are the filename and size and first line concatonated onto the same line. I suspect some kind buffering issue..?

-----
Of all the things I've lost in my life, its my mind I miss the most.

Replies are listed 'Best First'.
Re: Re: Re: Transmit file over socket
by Roger (Parson) on Jan 20, 2004 at 07:44 UTC
    Could be. Thinking about the client/server program again, I would probably use the Net::TCP::Server module to implement the server. Much easier.
    use strict; use warnings; use Net::TCP::Server; # create listener my $lh = 'Net::TCP::Server'->new(8000) or die; while (my $sh = $lh->accept) { defined(my $pid=fork) or die "fork: $!\n"; if ($pid) { # parent doesn't need client fh $sh->stopio; next; } # child doesn't need listener fh $lh->stopio; # do per-connection stuff here # read from the socket exit; }