Topic: Weird "error state on socket" with simple code.

Hi I'm compiling a simple server - client with CyaSSL embedded SSL.
My client and server compile well and the client can connect to web SSL server pages without any problem.

However, when it bind to my server i got a "error state on socket", see below.
- I wait 3 seconds before the tcp socket bind or connect before going with the SSL accept or SSL connect layer.
- My tcp socket are quite very standard without any fency parameters.

Do someone have a clue about what this mean?

env:
- Library and program compiled on a 32bits Linux Mint
- Using code::blocks 10.05

Server side output:

[...]
CyaSSL Leaving SSL_new, return 0
CyaSSL Entering SSL_set_fd
CyaSSL Leaving SSL_set_fd, return 1
CyaSSL Entering SSL_accept()
growing input buffer

Embed Receive error
    General error
CyaSSL error occured, error = -208
CyaSSL Entering SSL_get_error
CyaSSL Leaving SSL_get_error, return -208
CyaSSL Entering ERR_error_string
Error connecting: [-1] error state on socket
CyaSSL Entering SSL_get_fd
CyaSSL Leaving SSL_get_fd, return -1
CyaSSL Entering SSL_free
CTX ref count not 0 yet, no free
Shrinking input buffer

CyaSSL Entering BIO_free
CyaSSL Leaving SSL_free, return 0

Client side output:

[...]
CyaSSL Leaving SSL_new, return 0
CyaSSL Entering SSL_set_fd
CyaSSL Leaving SSL_set_fd, return 1
CyaSSL Entering SSL_connect()
growing output buffer

Shrinking output buffer

connect state: CLIENT_HELLO_SENT
growing input buffer

Embed receive connection closed
CyaSSL error occured, error = -208
CyaSSL Entering SSL_get_error
CyaSSL Leaving SSL_get_error, return -208
CyaSSL Entering ERR_error_string
SSLsetfd: 1Error connecting: [-1] error state on socket
Abort on error!

thanks. unkode

Share

Re: Weird "error state on socket" with simple code.

My socket on the server is simple as that, the client get the same parameters:


int Cssl_layer::open_listener(int port)
{
        int sd;
    struct sockaddr_in addr;

    sd = socket(PF_INET, SOCK_STREAM, 0);
    addr.sin_family = AF_INET;
    addr.sin_port = htons(port);
    addr.sin_addr.s_addr = INADDR_ANY;
    if ( bind(sd, (struct sockaddr*)&addr, sizeof(addr)) != 0 )
    {
        perror("can't bind port");
        abort();
    }
    if ( listen(sd, 10) != 0 )
    {
        perror("Can't configure listening port");
        abort();
    }

    sleep(3);
    printf("socket binded.\r\n");
    return sd;
}

Share