It looks like ActiveState perl strikes again.
That strange, because I'm using ActiveState Perl also.
I guess it is blocking.
Sockets are blocking by default and nothing in the code you posted attempts to set them as non-blocking.
Before I start reading from the IO::Socket in the Client3 I can write to it. Once I start reading from it in Client3::get_message() what I write to the socket is never sent to the other side of the socket.
You cannot simultaneously read and write to a blocking socket. It's like using a walky-talky. There is no point in talking whilst the person on the other end is transmiting, because they will not hear you.
But I don't see the need for a non-blocking socket for implementing the SMTP protocol?
It is a command-response protocol. Your client3 code should work in the same way as the Client2 code. Wait for a command, and once you get one, make no more reads until it has finshed sending the complete response to that command.
In reply to Re^3: Using Threads For Simple SMTP Relay Server
by BrowserUk
in thread Using Threads For Simple SMTP Relay Server
by lamberms
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |