in reply to Re: sockets and such in Perl
in thread sockets and such in Perl
My problems up until this point have really centered around this one fact, returning control to a process earlier on the pipeline and repeating the cycle of: if(match)then pass on to next process... this is complicated by the fact that the Eclipse/EPIC debugger craps out on me when I try and step through the code of any one of these processes (with the other two running in the background) and I can't seem to get my STDOUT print statements to work reliably once I've opened a socket for writing.
Can anyone give me an example of how to use a single socket in a bidirectional manner?
For instance, if I set a socket up to receive:
my $s_socket = IO::Socket::INET-> new('LocalPort' => $S_PORT, 'Proto' => 'tcp', 'Listen' => 2) or die "Third: Can't create socket to Second($!)\n"; while (my $second = $s_socket->accept) {...}
but then later on need to send over that same socket:
while(<$second>) { if($_ eq $match) { print $s_socket "$match\n"; scalar <$s_socket>; last; } }
Am I doing this in the correct manner - what steps am I forgetting? In a nutshell the statement above (both sending and on the receiving process end) is what has been giving me the most headache.
Any help would be much appreciated!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: sockets and such in Perl
by nothingmuch (Priest) on Jul 03, 2005 at 19:27 UTC | |
by scotchfx (Sexton) on Jul 03, 2005 at 20:24 UTC | |
by nothingmuch (Priest) on Jul 04, 2005 at 03:39 UTC |