Hi, in one 6678 board, I use accept() in ndk to accept new connection from another board, my program is like the following:
NetworkOpen()
{
TaskCreate(taskFxn, "name", arg0,...);
}
void taskFxn()
{
SOCKET s;
struct sockaddr_in servaddr, cliaddr;
s = socket(AF_INET, TCP_STREAM, 0);
bind(s, (PSA)&servaddr, sizeof(servaddr);
listen(s, MAXCONNECT);
SOCKET cli_sock;
while(1)
{
if((cli_sock = accept(s, (PSA)&cliaddr, &len_cliaddr)) == INVALID_SOCKET)
{
printf("%d\n", fdError()); ------- (1)
}
else
{
printf("accpeted a new connection."; -------------(2)
}
}
When I debug the code above, after step over the accept(), the program is in running status, it doesn't execute the following (1) or (2) in the program. what is the matter? can anyone help me?