tcp socket problems

From: Jeff (joesiege_at_gmail.com)
Date: 04/15/05


Date: 15 Apr 2005 14:21:30 -0700

What can I say, I thought I used due dilligence. I wrote a client in C
that is having difficulty when the server does bad things. The symptom
manifests itself with EBADF on close(sock); I should have never reached
this point, but some guy named Murphy just loves poking his nose into
socket programming.

When we reach close(sock) and it sets the errno to EBADF, the program
is still okay. The problem is, I reuse that socket descriptor. It's at
that point, that bad things happen. (Usually it gets stuck in close).
What are some good strategies for recovering from a bad file descriptor
or never getting in that situation in the first place?

Here's my socket functions if anybody cares to peruse them:
ftp://ftp.joedog.org/pub/siege/beta/sock.c
ftp://ftp.joedog.org/pub/siege/beta/sock.h

Jeff



Relevant Pages

  • Re: tcp socket problems
    ... > manifests itself with EBADF on close; ... not refer to a socket or you are closing the same socket twice. ... I reuse that socket descriptor. ...
    (comp.unix.programmer)
  • RE: socket communication: socket doesnt connect
    ... = overlapped using I/O Completion Port (IOCP) ... I am a complete beginner in socket programming and in using threads. ... Your server is written in C++. ...
    (microsoft.public.win32.programmer.networks)
  • Is socket.shutdown(1) useless
    ... Issues of socket programming can be wierd, ... In my python books I find exclusive use of socket.close. ... the client closes the socket ...
    (comp.lang.python)
  • Re: Issues related with server architechture
    ... > I am working for an server application, ... > require information to the clients back. ... like one thread will be for main socket ... > find which socket is readable using a loop from MIN socket descriptor ...
    (comp.unix.programmer)
  • Re: Socket relared problem (getting free port number dynamically)
    ... You appear to be doing raw socket programming, which isn't really a good idea most of the ... on some event create a thread for validation purpose and then will ... but in this way i need to stick with port 20111.which i really don't ...
    (microsoft.public.vc.mfc)

Quantcast