Well, I've gotten my socket router working (almost). When I telnet to it, it does a complete SMTP transaction (or whatever else I ask it to- I tried HTTP as well) without a problem. But during an SMTP transaction, the script seems to block on multiline replies. The first line will go through, and it'll wait for the client to write before printing the rest of the reply, which it does all at once like it should. Here's the code: #!perl use IO::Socket; use IO::Select; use strict; my( $server, $client ); $/ = "\015\012"; $server = IO::Socket::INET->new( Listen => 5, LocalAddr => 'localhost', LocalPort => 25, Proto => 'tcp' ) || die( $@ ); # Create server socket print STDOUT "Server started on port 25.\n"; while( $client = $server->accept() ){ # Accept clients my $sock = IO::Socket::INET->new( PeerAddr => 'smtp.foobar.com', PeerPort => 'smtp(25)', Proto => 'tcp', Timeout => 2 ) or die($@); # Set up socket to mail server $sock->autoflush( 1 ); $client->autoflush( 1 ); print STDOUT "Connection on port 25.\n"; my $s = IO::Select->new( $sock ); my $c = IO::Select->new( $client ); while( 1 ){ # Forever (working on this next)... my @handles = $s->can_read( .01 ); # See if the server can be read from foreach my $fh( @handles ){ # If it can, print $client $fh->getline; # write what it does to the client } @handles = $c->can_read( .01 ); # Ditto the client foreach my $fh( @handles ){ print $sock $fh->getline; } } close( $sock ); close( $client ); print STDOUT "Connection closed.\n"; } There isn't a problem with the server, I've verified that- the router here gets the information correctly, but holds it for some reason. The smtp server sends the crlf correctly, and I've tried on more than one server with the same response. I wonder if IO::Socket is doing something smtp specific, though, because an http 'GET' didn't produce this problem. I created a file containing only the response from the smtp server (complete with crlf's) and got the web server to send it over verbatim. The result was a correct send without pauses. I've tried to get creative, doing a while() loop for reading in lines, doing a getlines() call, and even putting a flush() in creative places, but to no avail. The next stop is to rewrite this without IO::Socket, using just IO::Handle and IO::Select, and I don't like the sound of that much. Any help would be great. Thanks, strider PS- I saw a message while going through the archive that mentioned that IO::Socket and Socket.pm for MacPerl aren't up to date. Is that true? If so, can something be done about it? -- | --+-- A thing is worth what someone is willing to pay for it. | | ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org