ts-7000
[Top] [All Lists]

[ts-7000] Re: multi-thread programming

To:
Subject: [ts-7000] Re: multi-thread programming
From: "PeterElliot" <>
Date: Wed, 02 Sep 2009 11:45:28 -0000
--- 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/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU