Re: More Specific Broken Pipe Error

new topic     » goto parent     » topic index » view thread      » older message » newer message

Being an avid Euphoria user, but admittedly a very novice C user I actually have
more questions about
your questions than I do answers.

First, man 2 write when talking about error messages lists EPIPE "fd is
connected to a pipe or socket
whose reading end is closed. When this happens, the writing process will receive
a SIGPIPE signal: if
it catches, blocks or ignores this error, EPIPE is returned."

Questions about this:

You say errno would be set properly, but how is this passed into Euphoria?
Do I have to make a global integer in Euphoria or is this just not possible?

As I said, I have never recorded xxx equal to anything but the length of the
data sent.
(Possibly because the time it would return -1 it terminates with the broken
pipe)

I do use recv() instead of read, however I cannot make Euphoria pass strings to
C so I have been
unable to get send() to work properly.
And as far as "catching" the signal, other than poll() (which is not catching
the disconnect all the
time) I have no clue how to go about detecting the disconnection another way. Is
there some function
that would test a socket to see if it is still active?

thanks very much for your help so far,

Kayhlan

cense wrote:

> I would have figured the same as you in the situation, that write( ) would
> have
> returned an error code if it could not send data. Usually as described by the
> man file, if a file/socket descriptor was invalid -1 would be returned and
> errno set properly. But obviously this is not the case.
>
> Where in the man page did you see anything about SIGTERM? I could not see it.
> If your process getting the SIGTERM signal would explain everything because
> SIGTERM is the TERMINATION signal. When a process gets this signal is
> *usually*
> terminates hence the "broken pipe error"
>
> A solution might be to "catch" the shutting down of the client and properly
> disconnect the socket before any damage is done.
>
> On another note, I really do think that you should be using send( ) and recv(
> )
> instead of write( ) and read( ). send and recv were designed for sockets
> specifically while read and write were not. This is my only suggestion as i
> have no other thoughts on solutions at this moment.
>
> Hope some of my bullsh*t might help you.
>
> --
> evil, corruption and bad taste
> ^[cense]

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu