This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

socket error

Hi,  I have made a tcp server which works as follows:

for (;;) {

    server_fd = new_tcp_socket();

    bind(server_fd, "0.0.0.0:1234");

    listen(server_fd);

    client_fd = accept(server_fd);

    close(server_fd);

    do { exchange_data(client_fd); } while (is_alive(client_fd));

    close(client_fd);

}

This server serve only one client. 

I closed server_fd every time after accept because i want to maintain minimal number of sockets in using.

there are some other tasks may need to create socket for upload or download anytime.

the problem is Sl_Bind may return SL_EADDRNOTAVAIL after several loops.

another problem is:

[SOCK ERROR] - TX FAILED : socket client_fd , reason (-107)

then system reboot.

What's the reason of error SL_EADDRNOTAVAIL and

why SL_ENOTCONN cause system reboot rather then send/recv API return error code?