"Broken Pipe" issue...

This is a discussion on "Broken Pipe" issue... within the C Programming forums, part of the General Programming Boards category; Hello...! I have written a programme using sockets ( Server-Client model) and while i am running the prorgamme it prints ...

  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    22

    "Broken Pipe" issue...

    Hello...!

    I have written a programme using sockets ( Server-Client model) and while i am running the prorgamme it prints "Broken pipe"

    Do you know why i have that..? ANy recommedations?

    Thx you!!!

  2. #2
    Epy
    Epy is offline
    Fortran lover Epy's Avatar
    Join Date
    Sep 2009
    Location
    California, USA
    Posts
    949
    Let me google that for you

    That'll tell you why it's happening. Meanwhile, post the code so we can look at it?

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    This usually means something you were connected to broke the connection. For example, if you connect to a web server, make a request, receive the data, and then fail to disconnect, you may get a broken pipe, because web servers do not maintain persistent connections: they accept(), process a request, then close() the connection immediately.

    Needless to say, if a process dies, all it's connections are automatically closed.

    A broken pipe will not produce an error until you try to send() or recv(), but it is an immediate problem that may cause the underlying socket layer to go into overdrive and max the processor out. In other words, it is a serious potential problem with persistent connections that you need to deal with. The way I usually do this is to use a glib function, g_io_add_watch.

    IO Channels

    However, probably you do not want to bother with that as glib is (usually) available only on linux systems.

    I think select() will also help detect this problem right away.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. float calculation issue
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 05-26-2008, 04:56 AM
  2. re-entrancy pattern issue setbacks
    By George2 in forum Windows Programming
    Replies: 0
    Last Post: 04-12-2008, 02:23 AM
  3. type safe issue
    By George2 in forum C++ Programming
    Replies: 4
    Last Post: 02-12-2008, 08:32 PM
  4. Replies: 8
    Last Post: 01-17-2006, 04:39 PM
  5. my first issue of GDM
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 09-12-2002, 04:02 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21