A tcp connetion question

Discussion in 'C Programming' started by Jimmy, Jun 27, 2007.

  1. Jimmy

    Jimmy Guest

    They r two processes, for client and server, connected with TCP. Connection
    is OK.
    I killed the server process, while the client seems not to feel that before
    it sent some data by calling send().
    And it checked the errno, which indicated a segmentation fault error.

    Why should it be segmentation fault rather than something indicating
    disconnection?
     
    Jimmy, Jun 27, 2007
    #1
    1. Advertising

  2. On 27 Jun, 11:06, "Jimmy" <> wrote:
    > They r two processes, for client and server, connected with TCP. Connection
    > is OK.
    > I killed the server process, while the client seems not to feel that before
    > it sent some data by calling send().
    > And it checked the errno, which indicated a segmentation fault error.
    >
    > Why should it be segmentation fault rather than something indicating
    > disconnection?


    standard C has no support for TCP you need to ask on a platform
    specific group (eg. Windows or Unix). It might be an idea to post
    your code when you do that. I suspect the client is ignoring some
    error indication.


    --
    Nick Keighley
     
    Nick Keighley, Jun 27, 2007
    #2
    1. Advertising

  3. Jimmy

    Jimmy Guest

    > standard C has no support for TCP you need to ask on a platform
    > specific group (eg. Windows or Unix). It might be an idea to post
    > your code when you do that. I suspect the client is ignoring some
    > error indication.
    >
    >
    > --
    > Nick Keighley
    >


    Well, I realize the segmentation fault was caused by perror(errno), in which
    errno has the value of 29. Is that an invalid number?
     
    Jimmy, Jun 27, 2007
    #3
  4. In article <f5tmkv$78u$99.com>, Jimmy <> wrote:

    >Well, I realize the segmentation fault was caused by perror(errno), in which
    >errno has the value of 29. Is that an invalid number?


    Error numbers are implementation defined.

    A segmentation fault in perror() may well indicate some unrelated
    memory corruption, or that you have closed stderr.

    -- Richard
    --
    "Consideration shall be given to the need for as many as 32 characters
    in some alphabets" - X3.4, 1963.
     
    Richard Tobin, Jun 27, 2007
    #4
  5. On 27 Jun, 12:55, "Jimmy" <> wrote:

    - leave in attributions
    - leave in what you are replying to

    > > standard C has no support for TCP you need to ask on a platform
    > > specific group (eg. Windows or Unix). It might be an idea to post
    > > your code when you do that. I suspect the client is ignoring some
    > > error indication.

    >
    > > --
    > >Nick Keighley


    - don't quote signatures


    > Well, I realize the segmentation fault was caused by perror(errno), in which
    > errno has the value of 29. Is that an invalid number?


    which part of "you need to ask on a platform specific group" didn't
    you understand?

    --
    Nick Keighley

    My god it's full of stars!
    Dave Bowman, on seeing HAL's source code
     
    Nick Keighley, Jun 27, 2007
    #5
  6. Jimmy

    Richard Guest

    Nick Keighley <> writes:

    > On 27 Jun, 12:55, "Jimmy" <> wrote:
    >
    > - leave in attributions
    > - leave in what you are replying to
    >
    >> > standard C has no support for TCP you need to ask on a platform
    >> > specific group (eg. Windows or Unix). It might be an idea to post
    >> > your code when you do that. I suspect the client is ignoring some
    >> > error indication.

    >>
    >> > --
    >> >Nick Keighley

    >
    > - don't quote signatures
    >
    >
    >> Well, I realize the segmentation fault was caused by perror(errno), in which
    >> errno has the value of 29. Is that an invalid number?

    >
    > which part of "you need to ask on a platform specific group" didn't
    > you understand?


    Which part of "my god, haven't you become a bossy little twit" do you
    not understand?
     
    Richard, Jun 27, 2007
    #6
  7. Jimmy

    CBFalconer Guest

    Richard wrote:
    > Nick Keighley <> writes:
    >> On 27 Jun, 12:55, "Jimmy" <> wrote:
    >>
    >> - leave in attributions
    >> - leave in what you are replying to
    >>
    >>>> standard C has no support for TCP you need to ask on a platform
    >>>> specific group (eg. Windows or Unix). It might be an idea to post
    >>>> your code when you do that. I suspect the client is ignoring some
    >>>> error indication.
    >>>
    >>>> --
    >>>>Nick Keighley

    >>
    >> - don't quote signatures
    >>
    >>> Well, I realize the segmentation fault was caused by perror(errno),
    >>> in which errno has the value of 29. Is that an invalid number?

    >>
    >> which part of "you need to ask on a platform specific group" didn't
    >> you understand?

    >
    > Which part of "my god, haven't you become a bossy little twit" do you
    > not understand?


    You are obviously totally unaware that contravention of standard
    Usenet practice needs to be stamped on (and pointed out) at the
    earliest possible moment. "Jimmy" is obviously a new user, and
    unaware, and in need of information. Maybe also reading lessons.

    --
    <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
    <http://www.securityfocus.com/columnists/423>
    <http://www.aaxnet.com/editor/edit043.html>
    cbfalconer at maineline dot net



    --
    Posted via a free Usenet account from http://www.teranews.com
     
    CBFalconer, Jun 27, 2007
    #7
  8. Jimmy

    SM Ryan Guest

    "Jimmy" <> wrote:
    # They r two processes, for client and server, connected with TCP. Connection
    # is OK.
    # I killed the server process, while the client seems not to feel that before
    # it sent some data by calling send().
    # And it checked the errno, which indicated a segmentation fault error.
    #
    # Why should it be segmentation fault rather than something indicating
    # disconnection?

    Most likely problem is your error-handling code is blown. You need
    to capture the failure and find out where it is happenning. If you
    have a debugger, that should point directly to the fault; otherwise
    you can sprinkle printfs through the code to verify it is operating
    as expected.

    If you are using signal handlers, it's not safe to do I/O from there.

    --
    SM Ryan http://www.rawbw.com/~wyrmwif/
    We found a loophole; they can't keep us out anymore.
     
    SM Ryan, Jun 27, 2007
    #8
  9. >> standard C has no support for TCP you need to ask on a platform
    >> specific group (eg. Windows or Unix). It might be an idea to post
    >> your code when you do that. I suspect the client is ignoring some
    >> error indication.
    >>
    >>
    >> --
    >> Nick Keighley
    >>

    >
    >Well, I realize the segmentation fault was caused by perror(errno), in which
    >errno has the value of 29. Is that an invalid number?


    The first argument of perror() is supposed to be a *STRING*, which
    errno is not. This probably caused a segmentation fault. Guess what,
    nitpickers, this actually is a question about C.
     
    Gordon Burditt, Jun 28, 2007
    #9
  10. Jimmy

    Jimmy Guest

    > The first argument of perror() is supposed to be a *STRING*, which
    > errno is not. This probably caused a segmentation fault. Guess what,
    > nitpickers, this actually is a question about C.
    >


    Thanks a lot. I done made a blunt mistake!
     
    Jimmy, Jun 28, 2007
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anthony Kavassis
    Replies:
    0
    Views:
    393
    Anthony Kavassis
    Jan 29, 2004
  2. Wonderer
    Replies:
    9
    Views:
    1,311
  3. Sakcee
    Replies:
    4
    Views:
    545
    John J. Lee
    Apr 5, 2006
  4. Tiger
    Replies:
    5
    Views:
    1,012
    Dave Thompson
    May 1, 2006
  5. Zachary Manning

    newbie tcp/ip question

    Zachary Manning, Jun 24, 2007, in forum: Python
    Replies:
    0
    Views:
    228
    Zachary Manning
    Jun 24, 2007
Loading...

Share This Page