Re: cryptPopData returning 0 bytes
JexMcByte <[email protected]> Wed, 1 Aug 2012 07:59:32 -0700 (PDT)
| Newsgroups | gmane.comp.encryption.cryptlib |
|---|---|
| Message-ID | <[email protected]> |
Sometimes this happens, sometimes it waits for the server to send the message. But, when he waits he is receiving a different data then the one transmitted, Haven't done extensive debugging yet but, so far, seems that the code is correct. I can stop on the server sending the package X and in the client receiving Y. 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-tp34238140p34241165.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.