More Specific Broken Pipe Error

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

Ok. I have been at it all day and have narrowed down the possibilities. Perhaps
someone out
there can read this little example and may know why I am getting the Broken Pipe
error.

The following routine works flawlessly with connected sockets. The pipe crash
happens when
someone severs a link to the server by simply shutting off their client (a
generic MUD client)
and this routine tries to send information. However, the crash does not happen
in every
instance of this.

Most of the time poll () is able to pick up the disconnect and I automatically
shut them down.
In every instance, the person who is connected to the socket simply shut down
without entering
any information. Therefore, I think I can assume that it is not a problem of
buffered
information still waiting to be read because they reported little to no lag
before
disconnecting.  The code is as follows:

       game_output_buffer = allocate(length(text))
        poke(game_output_buffer, text)
        xxx = c_func(write, {n, game_output_buffer, length(text)})
        free(game_output_buffer)

        n is the file descriptor
        game_output_buffer and xxx are atoms

I have yet to record xxx being -1 and in all the man pages it tells of write
returning a SIGTRM
on error.  I hope this helps to describe the problem I am having a bit better.
If anymore is
needed please let me know and I will provide it. Again, I will appreciate any
feedback on this
as I have searched fruitlessly for the past 14 or so hours for the problem
and/or it's
solution, but so far with no success on either.

Cense wrote:


> Hi again Kayhlan,

> The "broken pipe error" just means that the socket connection has been broken.

> The communication between two sockets is done through a pipe and when that
> pipe

> breaks, so does the connection.
>
> This sounds rather similar to a problem i was having quite some time ago with
> a perl script that used linux sockets. I dont know for sure about your problem
> but i *think* that my problem (of similar nature) could have been due to the
> fact that i was sending data before the other side of my connection was
> replying to previous data. I dont know this for sure but now that you have
> brought this up, i will investigate again. Now i dont know why this would
> cause a pipe break because i was pretty sure TCP protected against this in
> some
> ways but then again, im no TCP/IP expert or anything of the sorts.
>
> Im going to try and find a solution now myself so then maybe i might be able
> to
> be of a little more assistance to you and my ex-perlscript.
>
> Dont give up :)
>
> --
> evil, corruption and bad taste
> ^[cense]

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

Search



Quick Links

User menu

Not signed in.

Misc Menu