Nigel Kerr | 9 Dec 2007 19:48
Picon

stream error on windows

good folk,

struggling some with getting libetpan .52 to work on windows.  my environment:

winxp pro
vs 2003
openssl 0.9.8g (libeay32.lib and ssleay32.lib!) built with same

had to #define EINPROGRESS WSAEINPROGRESS
had to remove references to unistd.h in a couple places
had to comment out a bit about feed_storage

then it compiles: the lib, sendsmtp and readmsg.  howmsoever:

if i invoke sendsmtp thus:

 sendsmtp -f me@... -u
me@... -v whatever -s
smtp.gmail.com -p 587 -S me@...

and a message text, i invariably get a stream error.  I have tracked
it down (i think) to:

 mailstream_socket.c:mailstream_low_socket_write(), the part where
"cancelled" is tested for non-zero.  cancelled is coming to us from
the win32 block above:

   event = CreateEvent(NULL, TRUE, FALSE, NULL);
   WSAEventSelect(socket_data->fd, event, FD_WRITE | FD_CLOSE);
   FD_SET(event, &fds_read);
   r = WaitForMultipleObjects(fds_read.fd_count, fds_read.fd_array,
FALSE, timeout.tv_sec * 1000 + timeout.tv_usec / 1000);
   if (r < 0)
     return -1;

   cancelled = fds_read.fd_array[r - WAIT_OBJECT_0];
   write_enabled = (fds_read.fd_array[r - WAIT_OBJECT_0] == event);

cancelled gets a value all the time here, since
fds_read.fd_array[r-WAIT_OBJECT_0] seems to always (still?) have a
value.  r is 1 in these cases, by which i take it to mean we're
sending two things in to be waited on.

i've naively attempted to use the non-WIN32 code instead, but that
didn't get me any different: cancelled gets a value that is not zero,
and we always return.

anyone have any insight here?  i'd like to use libetpan to send email
from a windows application, but i admit i'm not so much on the socket
programming.  anything i can try to debug?

cheers,
NIgel

-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

Gmane