This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FW: Closing sockets


Hello All

I'm running 2 boxes both with eCos, connected using TCP / IP. 

I'm trying to clear up a socket if the customer simply switches one of
the boxes off or removes the Ethernet cable - non graceful socket
closure.

After looking at the httpd code, I've written a TTL style timeout for
inactivity. This works, but when I try calling shutdown after detecting
the lost comms:

shutdown(mSocket, SHUT_WR);
shutdown(mSocket, SHUT_RD);

If a thread was busy writing to the socket as the power fails on the
other unit, the thread blocks on send(), and the calls to shutdown from
my lostcomms thread fail to wake the blocked sending thread.

I've tried calling cyg_thread_release(handle) but this looks risky as
you need to be very aware of what the thread was blocked on.

If there a better way of waking a thread which is blocked on socket IO,
after the connection has died, other than trying to shutdown the socket
as this seems unreliable.

TIA

Andrew.




--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]