Re: socket issue on linux c program



"ed" <ed@xxxxxxxxxxx> wrote in message
news:20060629213714.3473943d@xxxxxxxxxxxxxxxxxxxxxxxx
[snip]
When my TCP socket server runs it creates a thread per connection,
which is simple enough and works ok. However, when the TCP client
leaves without shutting down the connection by telling the server to
close, the program just dies. It seems I cannot capture this error.
After an strace I saw the following:

accept(3, 0xbff70c90, [16]) = ? ERESTARTSYS (To be
restarted)
+++ killed by SIGPIPE +++

By default, SIGPIPE is raised when you call write()/send() on a connection
that logically cannot be written to (eg because the connection has been
reset). The same as calling write() on a pipe with no readers.

I suggest you call sigaction() (or signal()) to ignore SIGPIPE during
initialisation of your server. Then, in the same situation, you will get
EPIPE or some other error where you write to the socket concerned instead.
Of course, you need to check every call for errors - but you should be doing
that in any case.

Alex


.



Relevant Pages

  • Re: Outgoing POP3 email missing/lost/not received
    ... Funny thing is that I have had this ISP for 8 years and it has always been ... It looks like when you last ran CEICW, you set the ISP's mail server to: ... Internet Connection Wizard. ... After the wizard completes, the following network connection ...
    (microsoft.public.windows.server.sbs)
  • Re: Cannot connect client to server 2003
    ... you need to reconfigure the IP schema of your SBS ... On the SBS 2003 Server open the Server Management console. ... On the Connection Type page, click Broadband, and then click Next. ... Alternate DNS server, type the IP addresses that are provided by your ISP ...
    (microsoft.public.windows.server.sbs)
  • Re: Outgoing POP3 email missing/lost/not received
    ... ISP's mail server instead of the domain name on the ... SUMMARY OF SETTINGS FOR CONFIGURE E-MAIL AND INTERNET ... Internet Connection Wizard. ... After the wizard completes, the following network connection ...
    (microsoft.public.windows.server.sbs)
  • Re: Networking Question - VLANs on SBS 2003 Premium SP1
    ... port on the old router so I now have a segregated WLAN. ... be sure you do not enable any DHCP server in internal network. ... On the Connection Type page, click Broadband, and then click Next. ... On the Network Connection, You must enable and configure the network ...
    (microsoft.public.windows.server.sbs)
  • Re: Still cant connect to RWW or OWA remotely
    ... it certainly appears to be something about the SBS configuration. ... Meridian.local Ethernet adapter Local Area Connection: ... Windows SMALL BUSINESS SERVER 2003 Windows IP Configuration ... 192.168.254.254) directly to a port on the router and then ...
    (microsoft.public.windows.server.sbs)