Thread: broken pipe

  1. #1
    Registered User
    Join Date
    Oct 2002

    broken pipe

    I am not sure if this belongs here or in the C board.

    I have been writing a simple server program.
    When a user connects I create a new thread to handle the user.
    There is another program that is used as a client to connect to the server.
    The user has the option to disconnect from the server. If the user does so I close out the socket and exit the thread.

    But if the user just does ctrl-c to kill the client program then I get an error "Broken Pipe" on the server, and it crashes. I think this has to do with the socket still being open but no one on the other end.

    Does anyone know any way to have the server handle the client program being killed with out crashing the server program?

    Let me know if It would help for me to post the server code here.
    I am writing the program in C, using gcc to compile on a FreeBSD unix machine.

  2. #2
    Registered User
    Join Date
    Oct 2002
    I decided that it would probably help to have the code, so I will attach it here.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. cont of IPC using PIPE
    By BMathis in forum C Programming
    Replies: 1
    Last Post: 03-15-2009, 05:16 PM
  2. Pipe class.
    By eXeCuTeR in forum Linux Programming
    Replies: 8
    Last Post: 08-21-2008, 03:44 AM
  3. Named pipe problem
    By rahul_c in forum C Programming
    Replies: 3
    Last Post: 10-02-2007, 05:40 PM
  4. Pipe(): Interprocess or Intraprocess comm?
    By @nthony in forum C Programming
    Replies: 2
    Last Post: 03-28-2007, 07:27 PM
  5. Pipe the console from a DLL
    By loobian in forum Windows Programming
    Replies: 12
    Last Post: 11-30-2003, 08:55 PM