Task blocked while sending a message to a internal socket. - VxWorks
This is a discussion on Task blocked while sending a message to a internal socket. - VxWorks ; Hello,
I have a query related to sockets.
I have created a socket between the tasks (T1 & T2) running on the
same board and my creation code from T1 is follows.
mbxSock = socket(AF_INET, SOCK_STREAM,0)
int reuse = 1;
...
-
Task blocked while sending a message to a internal socket.
Hello,
I have a query related to sockets.
I have created a socket between the tasks (T1 & T2) running on the
same board and my creation code from T1 is follows.
mbxSock = socket(AF_INET, SOCK_STREAM,0)
int reuse = 1;
setsockopt(mbxSock, SOL_SOCKET, SO_REUSEADDR, (char *) &reuse,
sizeof(int));
int flag = 1;
setsockopt(mbxSock, IPPROTO_TCP, TCP_NODELAY, (char *) &flag,
sizeof(int));
int bufferSize = 16384;
setsockopt(mbxSock,SOL_SOCKET,SO_SNDBUF,(char
*)&bufferSize,sizeof(int));
My task T2 listens to this internal socket from T1 and some other
external sockets also from different boards(using select call). When
my application is runnning, Task T1 is pending on a semaphore when it
was trying to send a message to this socket. Here is the callstack of
task T1
0x00ccfb4c -> send + 0x4c
0x00c7b008 -> bsdSend + 0xd0
0x00ce2b58 -> sosend + 0x2a4
0x00c77db4 -> sbwait + 0x2c
0x00c78b70 -> ksleep + 0x68
0x00cb8904 -> semTake + 0x140
0x00cb7d7c -> semBTake + 0x190
I thought other task T2 is not reading the messages from the socket
and that is the reason task T1 is not able to send message and
waiting. But if I observe the task T2 call stack, the last call is a
select call (Does it mean no messages are available in any of it's
sockets (internal + external)).
Can some body please tell me what is happening in the above
callstack and why task T1 is waiting for a semaphore and when the
above sequence of calls can come.
Thanks,
Nari.
-
Re: Task blocked while sending a message to a internal socket.
To add to the my above question.
I have read some discussions in the forum and came to know
that the send can block if it doesnot a sufficient mbufs to put the
message as i did not set the non blocking option from sending side.
Ok, i agree to this. That means this socket has data to
read. I have verifed the callstack of receiver to check why it is not
reading. Strange thing is the last call in the stack is semTask inside
the select function call but my task is not pending. Here is the
callstack.
0x00c90c64 -> select + 0x308
0x00cb8904 -> semTake + 0x140
0x00cb7d7c -> semBTake + 0x190
Can some body help me why select has not returned even
though my socket has the data to read.
One more doubt is, callstack shows the last call is
semBTake but my task state is not pending. How this can happen.
Thanks,
Nari