![]() |
|
|
|
|
|||||||
| IP Networking Questions involving TCP/IP, Routers, Hubs, Network protocols, etc go here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Checking the file if it exists | ksmbabu | Shell Programming and Scripting | 3 | 04-02-2008 02:16 AM |
| checking a connection | azmathshaikh | Shell Programming and Scripting | 3 | 08-20-2005 01:26 AM |
| Folder Exists | borncrazy | UNIX for Dummies Questions & Answers | 5 | 06-18-2004 10:48 PM |
| : /var/adm/utmp exists! | dangral | SUN Solaris | 2 | 02-27-2004 07:17 AM |
| Please help me with this script meant for checking /etc/passwd if a name exists | TRUEST | Shell Programming and Scripting | 4 | 03-04-2002 07:29 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi I have a bit of c code which I'm trying to use as a relay between apache and a scgi cluster.
Example of problem code is below: while((n = recv(scgiSock, local_data, MAX_LENGTH, 0)) > 0) { time(&t2); time_now = t2 - t1; if(time_now > TIMEOUT) throw 1; #ifdef UN_NES_DEBUG logger("scgi : length := ", 1, n); #endif logger("sending data: length = ", 1, n); logger("send ret:= %d", 1, send(receiveSock, local_data, n, 0)); count++; bzero(local_data, MAX_LENGTH + 1); sum += n; logger("Receiving data: current sum = ", 1, sum); } I'm encountering a slight but probably easily solveable problem; sometimes apache drops the connection and as a result my program crashes out when trying to send data back on the socket. Is there any way to check that the socket is still alive before sending data? Cheers. Fish. |
| Forum Sponsor | ||
|
|
|
|||
|
Quote:
option 2. install a SIGPIPE signal handler around the send() to catch any raised signal, then restore the handler after the send. |
|
|||
|
thanks,
I'm actually using the select() function when I receive information from apache. but I didn't know you could use it to check for sending as well. I'll have to look into that a bit more. would you happend to have any examples of using select in a send situation? I'm might as well set up the SIGPIPE signal error capture as well. you have any good examples of this? Cheers. Fish. |
|||
| Google UNIX.COM |
| Thread Tools | |
| Display Modes | |
|
|