Code: Select all
socket(addrFamily, SOCK_DGRAM, ipProtocol);
Code: Select all
socket(addrFamily, SOCK_STREAM, ipProtocol);
I can see the new fd number for the new socket() still increasing, it can be from 58, 59, 60.... until 64, then no longer can make new socket() (errno 23, reached maximum fd).
Even I just create it and never really use it.
The code looks like
Code: Select all
sock = socket(addrFamily, SOCK_DGRAM, ipProtocol);
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout);
int err = bind(sock, (struct sockaddr *)&destAddr, sizeof(destAddr));
recvfrom(sock, rxBuffer, sizeof(rxBuffer) - 1, 0, (struct sockaddr *)&sourceAddr, &socklen);
//--------This task is being blocking since there are no incoming data--------
Code: Select all
vTaskDelete(the above task handler);
close(sock);
Is it anything wrong with my code? Do I missed something for close/release the socket?
Thank you!