Thread: Why the local socket program occur core dump?

  1. #16
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    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.

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, 12:39 PM
  5. segmentation core dump - need help
    By knight101 in forum C++ Programming
    Replies: 1
    Last Post: 11-26-2001, 04:43 PM