--- In "u_d_thacker" <> wrote:
>
> Hello experts,
> I have 7260 board. In coding I have used socket and thread
> concept. In socket, to receive data I have used recv() function. but due to
> this an problem occurs in threading. Due to this, other thraeded functions
> get quit. so what should I do to overcome this problem. pls..........help
> me.......
>
Hi,
I had a similar problem recently with my Modbus TCP code, in that the code
would run fine until something happened to the device I was talking to - at
which point my program simply terminated without warning.
My solution was to add a MSG_NOSIGNAL as a flag in the socket send code. As I
hadn't set up a signal handler, the program was simply terminated when a signal
occurred!
My TCP send commands now look like:
MBsentBytes=send(ModbusSock,MBoutButter,MBlen,MSG_NOSIGNAL);
Since making the changes I've had no unexpected termination.
Another option is to use the following at the start of the program:
signal(SIGPIPE,SIG_IGN);
The send() function will then return -1 and set errno to EPIPE in this
situation.
Hope this helps with your issue,
PJE
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|