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.

TMS320F28388D: Creating a non-blocking socket in NDK

Part Number: TMS320F28388D


Hi,

I want to make a non-blocking socket in NDK. After searching over the internet, I found out I can do it in the following way:

int isEnabled = 1;

status = setsockopt(socketHandler, SOL_SOCKET, SO_NONBLOCKING, (char*) &isEnabled, sizeof(isEnabled));

However, when I create the socket and set the non-blocking option in this way, the "connect" function will be failed and it returns -1. So, I would appreciate it if someone can guide me on how can I successfully create a socket with the non-blocking option in NDK?

A note: When I initialize the variable "isEnabled" with 0, everything works well. However, I'm not sure whether the socket has been set with the non-blocking option or not.

Best,

Alex