Hi,
When we open a TCP socket in our nRF9151 application, we set it to non-blocking.
The flow:
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); ... setsockopt(fd, SOL_SOCKET, SO_RAI, &rai, sizeof(rai)); nrf_fcntl(fd, NRF_F_SETFL, NRF_O_NONBLOCK);
Sometimes, seemingly at random, nrf_fcntl() returns -1 and errno == 9 (EBADF).
We also check the return values of socket() and setsockopt() and both of those succeed right before fcntl! fd >= 0 and the return value of setsockopt() is 0.
What does it mean when nrf_fcntl returns EBADF here? It appears this happens at random.