A tcp connetion question

J

Jimmy

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?
 
N

Nick Keighley

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

Jimmy

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.

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

Richard Tobin

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
 
N

Nick Keighley

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

- 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?
 
R

Richard

Nick Keighley said:
- 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.

- 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?
 
C

CBFalconer

Richard said:
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.
 
S

SM Ryan

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

Gordon Burditt

standard C has no support for TCP you need to ask on a platform
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.
 
J

Jimmy

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!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top