> -----Original Message----- > From: henk b [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 18, 2002 11:39 AM > To: [EMAIL PROTECTED] > Subject: inetd client server communications > > > I'm trying to make an inetd perl server to communicate with a > perl client. > Communication from client to server is working but not from server to > client. As I understand inetd handles the socket, bind, > listen and accept > stuff and basically you can communicate between server and > client using > STDIN and STDOUT. But it's not working and I'm stuck.
On the server side, that's correct. The client has to set up a socket and communicate through that. See below. > > Does anyone know what I'm doing wrong/can help me going again? > > Thanks Henk > > > This is what I've got sofar.: > > ==/etc/services====================================================== > psad 1200/tcp # Test perl > inetd daemon > ==/etc/inetd.conf ==================================================== > psad stream tcp nowait root /tmp/server.prl > > ==server.prl======================================================== > #!/usr/bin/perl > > open (OUTFILE, ">/tmp/effe1"); # Open output file > select(OUTFILE); $|++; # Unbuffered output OUTFILE > select(STDOUT); $|++; # Unbuffered output STDOUT > > while (<STDIN>) { > print OUTFILE $_; # Write client lines to OUTFILE > } > > print "Output for standard out\n"; # Send lind to client > close (OUTFILE); # Close output file > > ==client.prl========================================================== > #!/usr/bin/perl > > use IO::Socket; > > # Setup connection to server , for now on same host > $sock = IO::Socket::INET->new( PeerAddr => 'localhost', > PeerPort => 1200, > Proto => 'tcp', > ); > unless ($sock) {die "Socket could not be created, Reason: $!"} > > foreach (1..100) { > print $sock "Line $_\n"; # Send lines to server > } > > # Hope to receive output from server and store in file > open (OUTFILE, ">/tmp/effe2") || die "can't open outfile $!"; > $a = <STDIN>; Shouldn't you be reading from $sock and not STDIN here? > print OUTFILE $a; > > close (OUTFILE); # Close output file > close ($sock); # Close connection > > _________________________________________________________________ > Get your FREE download of MSN Explorer at > http://explorer.msn.com/intl.asp. > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]