If I have a connected socket in the parent task,how can I use the socket in the child task which is a send task?
thanks
michel
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
If I have a connected socket in the parent task,how can I use the socket in the child task which is a send task?
thanks
michel
I use CCS5.2, and the mcsdk is 2.01,bios 6.33,ndk 2.21.
I create a TCP socket and make it connected in the parent task, then i create a send task,
the code is "TaskCreate( TCP_perform_send, "TCPSX", OS_TASKPRINORM, 0x1000, (UINT32)TaskSelf(), (UINT32)stcp_child, 0 );"
stcp_child is a connected socket.
In the TCP_perform_send function ,I use
fdOpenSession( TaskSelf() );
A=fdShare(stcp_child);
but A is -1 that means fdShare(stcp_child) failed, and I don't know why.
Try calling fdError() after fdShare to see why fdShare is failing (returns an int). The error code definitions are in \ndk_2_21_x_x\packages\ti\inc\serrno.h
Post back what you get and we can go from there.
It returns 9,which means a invalid socket. But I printf the FD of socket,it is the same as the FD of the socket of parent. So I don't know why it is?
I will investigate- there might be extra setup required if a socket is to be shared (that is not "shared" in the NDK document).
My first test will be to add a call to fdshare to the ndk helloworld example.
Michel-
I found this post that may help: http://e2e.ti.com/support/embedded/bios/f/355/p/120158/429219.aspx#429219
Let us know if this solves your problem!
Mike