> Hello folks, Howdy, Funny I was just thinking about Sockets today. I don't use them nitty gritty like this but I would assume you need to do multiple send/receive/accept in a little session via your own prtocol.
Something like: Client> hello Server> howdy Client> NAME fred.txt Server> NAMEIS fred.xt Thanks - SENDFILE Client> FILE .... Server> Thanks Writing file...FILEOK Client> bye I am done Server> bye hava good one I'm interested in seeing how to do this, sorry it probably wasn't much help. > > How do I send the file name used by the client so that the > server uses the same file name > When it is writing it own file. > > > thank you. > > --------------------------------here's the client: > > use IO::Socket; > > my $server = IO::Socket::INET->new( > PeerAddr => 'localhost', > PeerPort => 5050, > Proto => 'tcp' > ) or die "Can't create client socket: $!"; > > > open FILE, "original_file_name"; > while (<FILE>) { > print $server $_; > } > close FILE; > > > --------------------------------Here's the server: > > use IO::Socket; > > my $server = IO::Socket::INET->new( > Listen => 5, > LocalAddr => 'localhost', > LocalPort => 5050, > Proto => 'tcp' > ) or die "Can't create server socket: $!"; > > my $client = $server->accept; > > > open FILE, ">copy_file_name" or die "Can't open: $!"; > while (<$client>) { > print FILE $_; > } > close FILE; > > > -------------------------------------------------- > > > > > > > -- > ______________________________________________ > Check out the latest SMS services @ http://www.linuxmail.org > This allows you to send and receive SMS through your mailbox. > > > Powered by Outblaze > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>