I see you still have the loop around socket->gets(). When is it necessary?
The error handling is much better, but the I/O errors still don't include the actual cause of the problem. That can be really frustrating; e.g. if only "Failed to open file foo" is logged somewhere with no hint why. Insufficient permissions? It doesn't exist? The directory doesn't exist? Someone else has an exclusive lock on it? Etc, etc. It's a pain to have to guess what happened. So never ignore the error info in errno.
I'd do something like this:
if(!socket->open_socket()) error("Unable to open socket: %s\n", strerror (socket->errno())); if(!socket->connect(host, port)) error("Unable to connect to %d:%d: %s\n", host, port, strerror (socket->errno()));
Also, by convention you should always end the error descriptions you give to error() with a newline. Various error formatting routines assume there is one.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-10-10 18:42: Subject: pop3 module
Hello,
i've modified the pop3 module according to your remarks. i still need to make objects instead of arrays (?), support TLS, and use an asynchronous mode, and implement optional commands.
You can read it here : http://lucane.org/~vincent/pike/POP3.pmod/Client.pike
Have a nice day, Vincent.
/ Brevbäraren