hello, i´m testing my application in EVK1100, and always the listen function return error. Can anybody help me?
The code //Create the NUM_SOCKET=8 connection to wait the accept for(i=0;i<NUM_SOCKET;i++)
{ //Create the 8 socket lSocket[i] = lwip_socket(AF_INET, SOCK_STREAM, 0); if (lSocket[i]<0) return;
//Bind to this socket memset((char *)&sLocalAddr[i], 0, sizeof(sLocalAddr[i]));
sLocalAddr[i].sin_family = AF_INET; sLocalAddr[i].sin_len = sizeof(sLocalAddr[i]); sLocalAddr[i].sin_addr.s_addr = htonl(INADDR_ANY); //MY LOCAL IP is 192.168.1.7 defined for me
sLocalAddr[i].sin_port = PortConnection[i]; //Ports of the table are 1500, 1501,1502...
if (lwip_bind(lSocket[i],(struct sockaddr *)&sLocalAddr[i], sizeof(sLocalAddr[i])) < 0)
{ //Error. Close the socket lwip_close(lSocket[i]); }
//Listen to the 8 socket.Maximum 10 connection for socket if ( lwip_listen(lSocket[i],10) != 0 )
{ lwip_close(lSocket[i]); //Always enter here } }
I don´t know the listen function fail. then i´ve using select to accept the connection