473,387 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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?
Jun 27 '07 #1
9 1356
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

Jun 27 '07 #2
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?
Jun 27 '07 #3
In article <f5**********@news.cn99.com>, Jimmy <lo*****@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
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Jun 27 '07 #4
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

Jun 27 '07 #5
Nick Keighley <ni******************@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?
Jun 27 '07 #6
Richard wrote:
Nick Keighley <ni******************@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.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

Jun 27 '07 #7
"Jimmy" <lo*****@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.
Jun 27 '07 #8
>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.

Jun 28 '07 #9
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!
Jun 28 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Stevey | last post by:
I have the following XML file... <?xml version="1.0"?> <animals> <animal> <name>Tiger</name> <questions> <question index="0">true</question> <question index="1">true</question> </questions>
7
by: nospam | last post by:
Ok, 3rd or is it the 4th time I have asked this question on Partial Types, so, since it seems to me that Partial Types is still in the design or development stages at Microsoft, I am going to ask...
3
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
10
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
53
by: Jeff | last post by:
In the function below, can size ever be 0 (zero)? char *clc_strdup(const char * CLC_RESTRICT s) { size_t size; char *p; clc_assert_not_null(clc_strdup, s); size = strlen(s) + 1;
4
by: Sakcee | last post by:
Hi this is really a stupid question, how can i get page rsponse from a site e.g. google.com port 80 form socket, can i do something import socket s = socket.socket( socket.AF_INET,...
56
by: spibou | last post by:
In the statement "a *= expression" is expression assumed to be parenthesized ? For example if I write "a *= b+c" is this the same as "a = a * (b+c)" or "a = a * b+c" ?
2
by: Allan Ebdrup | last post by:
Hi, I'm trying to render a Matrix question in my ASP.Net 2.0 page, A matrix question is a question where you have several options that can all be rated according to several possible ratings (from...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.