Re: cryptPopData returning 0 bytes
JexMcByte <[email protected]> Fri, 3 Aug 2012 13:23:11 -0700 (PDT)
| Newsgroups | gmane.comp.encryption.cryptlib |
|---|---|
| Message-ID | <[email protected]> |
I think this is being caused by the server Destroying the session before the client having time to call popData. If this is the case, can the server check if the client has read the data before destroying the session or can the act of destroying the session wait so everything that needs to be done is done ? Jacques JexMcByte wrote: > > I have two prog comunicating using a SLL channel. > > The server enters the waiting state and, as soon as the client flushes the > data it starts running again. > It pops the data, do some work and the pushes and flushed the data. > > Just after the client flushes the data it does a popdata to wait for the > server answer butt the return without error and with 0 bytes read before > the server has the chance to push the answer. > > I've tryed seting CRYPT_OPTION_NET_READTIMEOUT but the behavior remained > unchanged. > > Am I missing something ? > > server "code" > > > res = cryptCreateSession( &cryptSession, CRYPT_UNUSED, > CRYPT_SESSION_SSL_SERVER ); > /* Add the server key/certificate and activate the session */ > res = cryptSetAttribute( cryptSession, CRYPT_SESSINFO_PRIVATEKEY, privKey > ); > res = cryptSetAttribute( cryptSession, CRYPT_SESSINFO_SERVER_PORT, > thisPtr->port ); > > res = cryptSetAttribute( cryptSession, CRYPT_SESSINFO_ACTIVE, 1 ); > > // some work > > res = cryptPushData( cryptSession, &buf, sizeof(buf), &bytesCopied ); > res = cryptFlushData( cryptSession ); > > res = cryptDestroySession( cryptSession ); > > client "code" > > > int res = cryptCreateSession( &cryptSession, CRYPT_UNUSED, > CRYPT_SESSION_SSL ); > res = cryptSetAttribute( cryptSession, CRYPT_OPTION_NET_READTIMEOUT, 30 > ); > res = cryptSetAttributeString( cryptSession, CRYPT_SESSINFO_SERVER_NAME, > serverAddress, strlen(data->serverAddress) ); > res = cryptSetAttribute( cryptSession, CRYPT_SESSINFO_SERVER_PORT, port > ); > res = cryptSetAttribute( cryptSession, CRYPT_SESSINFO_ACTIVE, 1 ); > res = cryptPushData( cryptSession, &buf, sizeof(buf), &bytesCopied ); > res = cryptFlushData( cryptSession ); > res = cryptPopData( cryptSession, &answer, sizeof(answer), &bytesCopied > ); // this returns OK but with bytesCopied with 0 > res = cryptDestroySession( cryptSession ); > > Thanks in advance, > Jacques > -- View this message in context: http://old.nabble.com/cryptPopData-returning-0-bytes-tp34238140p34252696.html Sent from the Cryptlib mailing list archive at Nabble.com. _______________________________________________ Cryptlib mailing list [email protected] via Mail: [email protected] Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/ http://news.gmane.org/gmane.comp.encryption.cryptlib Posts from non-subscribed addresses are blocked to prevent spam, please subscribe in order to post messages.