> Adding to David's response... > > MSG_PEEK is problematic on some systems. On Windows for example > (maybe only > the 9x series, but a problem none-the-less) using MSG_PEEK will > effectively > freeze the contents of the buffered data that can be seen with MSG_PEEK, > meaning that any further peeks will not be able to see any subsequently > received data. This means that if you need to peek at 4 bytes > and only one > has arrived when you perform the first peek you will never see > the following > three bytes and will therefore hang or need to abort.
Which could happen even without MSG_PEEK. TCP does not guarantee that it can ever receive any particular number of bytes at one time. This is another reason you will see such a violent knee-jerk reaction when you mention MSG_PEEK -- it is usually used to try to force TCP to do something it cannot do. > The BIO support in OpenSSL can help you. By using a BIO to wrapper the > socket and buffer data that you want to peek/push-back-on you can get a > similar result. There has been plently of BIO discussion on this list > recently and there are samples included with OpenSSL. Right. This way you still receive the data from the TCP or SSL engine immediately, allowing it to do its job. DS ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]