I have figured out how to set up bidirectional communication through sockets by forking the server and the client - The client forks just fine under Linux, but if I take the script to Win32 fork doesn't seem to work. This is the code for both the server and client:
Here's the server: #!/usr/bin/perl use IO::Socket; $SIG{CHLD} = sub {wait ()}; $main_sock = new IO::Socket::INET (LocalHost => 'shell', LocalPort => 1200, Listen => 5, Proto => 'tcp', Reuse => 1,) or die "Couldn't create socket: $!\n"; while ($new_sock = $main_sock->accept()) { $pid = fork(); die "Cannot fork: $!\n" unless defined($pid); if ($pid == 0) { # Child Process while (defined ($buf = <$new_sock>)) { chomp($buf); print "Client said: $buf\n"; print $new_sock "You said: $buf\n"; } exit(0); } } close ($main_sock); And here's the client: #!/usr/bin/perl use IO::Socket; $client = new IO::Socket::INET (PeerAddr => 'shell', PeerPort => 1200, Proto => 'tcp' ) or die "Couldn't create socket: $!\n"; my $pid = fork(); die "Cannot fork\n" unless defined $pid; if ($pid) { write_sock(); waitpid($pid, 0); } else { read_sock(); } sub write_sock { for (1 .. 10) { print $client "$_\n"; } } sub read_sock { while (my $line = <$client>) { print $line; # report to stdout } } Like I said, this works just fine on Linux->Linux. When the client is Win32 however - it writes to the server just fine, but will just sit there and never read. When I press control-C to escape out of the program, it THEN reads the data from the server. I tried reading into IO::Select to see if that would fix my problem with the client, but I just can't figure it out. Can someone help me with this?? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]