Why the local socket program occur core dump?

This is a discussion on Why the local socket program occur core dump? within the Linux Programming forums, part of the Platform Specific Boards category; From http://linux.die.net/man/2/accept : The argument addr is a pointer to a sockaddr structure. This structure is filled in with the ...

  1. #16
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,651
    From http://linux.die.net/man/2/accept:
    The argument addr is a pointer to a sockaddr structure. This structure is filled in with the address of the peer socket, as known to the communications layer. The exact format of the address returned addr is determined by the socket's address family (see socket(2) and the respective protocol man pages). The addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr; on return it will contain the actual length (in bytes) of the address returned. When addr is NULL nothing is filled in.
    Emphasis mine; reading comprehension FTW.
    Last edited by rags_to_riches; 08-16-2010 at 09:06 AM. Reason: Fixed link, removed italics...I failed the reading comprehension test myself.

  2. #17
    Registered User
    Join Date
    Feb 2008
    Location
    China
    Posts
    28
    Quote Originally Posted by rags_to_riches View Post
    From http://linux.die.net/man/2/accept:


    Emphasis mine; reading comprehension FTW.
    Got it, thanks, I have read this but it confuse me that:
    So it should means the *addrlen should be initialized. I thought not NULL is enough.
    Last edited by chenayang; 08-16-2010 at 08:52 AM.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 15
    Last Post: 10-20-2009, 09:39 AM
  2. Local Time Program
    By Ronzel in forum C++ Programming
    Replies: 1
    Last Post: 06-18-2009, 07:19 AM
  3. Core Dump in While()
    By KrepNatas in forum C Programming
    Replies: 5
    Last Post: 05-17-2005, 11:15 AM
  4. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 11:39 AM
  5. segmentation core dump - need help
    By knight101 in forum C++ Programming
    Replies: 1
    Last Post: 11-26-2001, 03:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21