Hello Champs,
Customer added below NDK servers to the Client example.
hEcho = DaemonNew( SOCK_STREAMNC, 0, 7, dtask_tcp_proc,//dtask_tcp_echo,
OS_TASKPRINORM, OS_TASKSTKNORM, 0, 3 );
hEchoUdp = DaemonNew( SOCK_DGRAM, 0, 7, dtask_udp_proc,//dtask_udp_echo,
OS_TASKPRINORM, OS_TASKSTKHIGH, 0, 1 );//OS_TASKSTKNORM,换成更大的堆栈大小
hData = DaemonNew( SOCK_STREAM, 0, 1000, dtask_tcp_datasrv,
OS_TASKPRINORM, OS_TASKSTKNORM, 0, 3 );
hNull = DaemonNew( SOCK_STREAMNC, 0, 1001, dtask_tcp_nullsrv,
OS_TASKPRINORM, OS_TASKSTKNORM, 0, 3 );
hOob = DaemonNew( SOCK_STREAMNC, 0, 999, dtask_tcp_oobsrv,
OS_TASKPRINORM, OS_TASKSTKNORM, 0, 3 );
She has configured the socket parameters in the first dtask_tcp_echo function, then receive the data and send them out, at last use fdClose( s ) close this socket。
to.tv_sec = 5;
to.tv_usec = 0;
setsockopt( s, SOL_SOCKET, SO_SNDTIMEO, &to, sizeof( to ) );
setsockopt( s, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof( to ) );
...
fdClose( s );
Customer used internet assistant to transmit data. After the ethernet is connected, it will enter the dtask_tcp_echo() and close the socket in 5s, then the internet is disconnected.
She wanted to keep the tcp in connection status, so she removed the fdclose. The host shows that the internet is connected. But the dtask_tcp_echo is only called when creating TCP socket. After transmitting the data, the dtask_tcp_echo will not be called, so it can't receive data any more. So how to resolve this problem?
Thanks.
Rgds
Shine