A tcp connetion question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jimmy

    A tcp connetion question

    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?


  • Nick Keighley

    #2
    Re: A tcp connetion question

    On 27 Jun, 11:06, "Jimmy" <lofe...@yahoo. com.cnwrote:
    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

    Comment

    • Jimmy

      #3
      Re: A tcp connetion question

      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?


      Comment

      • Richard Tobin

        #4
        Re: A tcp connetion question

        In article <f5tmkv$78u$1@n ews.cn99.com>, Jimmy <lofenee@yahoo. com.cnwrote:
        >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
        --
        "Considerat ion shall be given to the need for as many as 32 characters
        in some alphabets" - X3.4, 1963.

        Comment

        • Nick Keighley

          #5
          Re: A tcp connetion question

          On 27 Jun, 12:55, "Jimmy" <lofe...@yahoo. com.cnwrote:

          - 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

          Comment

          • Richard

            #6
            Re: A tcp connetion question

            Nick Keighley <nick_keighley_ nospam@hotmail. comwrites:
            On 27 Jun, 12:55, "Jimmy" <lofe...@yahoo. com.cnwrote:
            >
            - 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?

            Comment

            • CBFalconer

              #7
              Re: A tcp connetion question

              Richard wrote:
              Nick Keighley <nick_keighley_ nospam@hotmail. comwrites:
              >On 27 Jun, 12:55, "Jimmy" <lofe...@yahoo. com.cnwrote:
              >>
              >- 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.securityfoc us.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

              Comment

              • SM Ryan

                #8
                Re: A tcp connetion question

                "Jimmy" <lofenee@yahoo. com.cnwrote:
                # 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.

                Comment

                • Gordon Burditt

                  #9
                  Re: A tcp connetion question

                  >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.

                  Comment

                  • Jimmy

                    #10
                    Re: A tcp connetion question

                    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!


                    Comment

                    Working...