Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > A tcp connetion question

Reply
Thread Tools

A tcp connetion question

 
 
Jimmy
Guest
Posts: n/a
 
      06-27-2007
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?


 
Reply With Quote
 
 
 
 
Nick Keighley
Guest
Posts: n/a
 
      06-27-2007
On 27 Jun, 11:06, "Jimmy" <(E-Mail Removed)> 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

 
Reply With Quote
 
 
 
 
Jimmy
Guest
Posts: n/a
 
      06-27-2007
> 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?


 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      06-27-2007
In article <f5tmkv$78u$(E-Mail Removed)99.com>, Jimmy <(E-Mail Removed)> 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.
 
Reply With Quote
 
Nick Keighley
Guest
Posts: n/a
 
      06-27-2007
On 27 Jun, 12:55, "Jimmy" <(E-Mail Removed)> 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

 
Reply With Quote
 
Richard
Guest
Posts: n/a
 
      06-27-2007
Nick Keighley <(E-Mail Removed)> writes:

> On 27 Jun, 12:55, "Jimmy" <(E-Mail Removed)> 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?
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      06-27-2007
Richard wrote:
> Nick Keighley <(E-Mail Removed)> writes:
>> On 27 Jun, 12:55, "Jimmy" <(E-Mail Removed)> 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

 
Reply With Quote
 
SM Ryan
Guest
Posts: n/a
 
      06-27-2007
"Jimmy" <(E-Mail Removed)> 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.
 
Reply With Quote
 
Gordon Burditt
Guest
Posts: n/a
 
      06-28-2007
>> 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.

 
Reply With Quote
 
Jimmy
Guest
Posts: n/a
 
      06-28-2007
> 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!


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bad connetion good signel straight using multible wifi cards tom@mywebstyle.com Wireless Networking 1 04-27-2008 02:23 PM
socket connetion to url with port 80 Sakcee Python 4 04-04-2006 11:18 PM
NAT two outside TCP ports to one inside TCP port Kevin Cisco 1 11-10-2004 08:15 AM
2 sites, connected with PPP T1, internet connetion on both sides - REDUNDANT INTERNET POSSIBLE? jkeegan@optonline.nnet Cisco 4 09-08-2004 09:10 PM
Read signal strength of network connetion Jürgen Wagner Wireless Networking 1 08-16-2004 09:58 PM



Advertisments