On 01/09/16 12:36, Nikola Milev wrote: > listenfd = socket (AF_INET, SOCK_STREAM, PROTOCOL); > if(listenfd < 0) > { > exit_msg("socket() error"); > } The fact that this worked suggests that maybe we aren't sending what we think we are sending as the parameters to the equivalent socket call in OpenSSL. Either that or something really weird is happening that causes it to fail when called from OpenSSL, but not from a standalone program!! Did you compile OpenSSL yourself, or are you using pre-built binaries? If you compiled it yourself then I could provide you with a small patch to instrument the code to figure out what parameters are being sent to "socket"...either that or you could take a look at it in a debugger if it has been compiled with debugging symbols. Matt