Thanks, I redid my connect script to check WANTREAD and WANTWRITE, and it
works fin now.
I made similar changes to my read function, but it's only getting a portion
of the message still, after a successsful connect:

E_SSL_WRITEABLE and E_SSL_READABLE relate to WANTREAD and WANTWRITE,
E_SSL_NOERROR is the NOERROR state, and
E_SSL_ERROR is any other error condition.
--- FUNC ---
   while (((Error == E_SSL_READABLE) || (Error == E_SSL_WRITEABLE))
           && (NumRead < MAX_LINE)) {
      LogLine("Trying read");
      err = SSL_read(ssl, buffer, sizeof(buffer) - 1);
      buffer[err] = '\0';
      snprintf(temp_message, 100, "Got %d chars (%s)", err, buffer);
      LogLine(temp_message);
      NumRead += err;
      strcat(templine, buffer);
      strcpy(buffer, "");
      Error = CheckSSLError(err);
   }
   if (Error == E_SSL_ERROR) {
      LogLine("E_SSL_ERROR from read");
      return 0;
   }
   else if (Error == E_SSL_NOERROR) {
      LogLine("E_SSL_NOERROR from read");
   }
   LogLine("Done read");
--- FUNC ---

And this spins a few times, then gets 3 (always) of the 11 chars sent and
gets to "Done read":
It should get "HELLO WORLD".

--- OUTPUT ---
Reading...
Trying read
Got -1 chars ()
More data to read!
(last 3 lines repeated 19 times)
Trying read
Got 3 chars (HEL)
Done read
--- OUTPUT ---

Thanks for the assistance.

-- Jeff.


-----
Jeff Magnusson ([EMAIL PROTECTED])
River Styx Internet


> -----Original Message-----
> From: Bodo Moeller [mailto:[EMAIL PROTECTED]]
> Sent: April 30, 2000 6:46 AM
> To: Jeff Magnusson; [EMAIL PROTECTED]
> Subject: Re: Is that possible to add timeout to SSL_connect and
> SSL_accept?
>
>
> Jeff Magnusson <[EMAIL PROTECTED]>:
>
> > On a similar tack, how do I connect to a server when my socket is
> > non-blocking.
> >
> > I've got a non-blocking Winsock socket and when I call
> SSL_connect to start
> > negotiation with the server, it returns an error with
> SSL_ERROR_WANT_READ
> > set.
>
> Wait for readable data at the socket, then call SSL_connect again,
> until the error code is not SSL_ERROR_WANT_READ/WRITE.
> See the SSL_get_error() manual page,
> <URL: http://www.openssl.org/docs/ssl/SSL_get_error.html>.
>

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to