*BSD News Article 52624


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!goanna.cs.rmit.EDU.AU!munnari.oz.au!spool.mu.edu!news.moneng.mei.com!daily-planet.execpc.com!sundog.tiac.net!news.kei.com!news.mathworks.com!newsfeed.internetmci.com!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!lerc.nasa.gov!purdue!yuma!csn!nntp-xfer-2.csn.net!boulder!news.coop.net!village.org!not-for-mail
From: imp@village.org (Warner Losh)
Newsgroups: comp.unix.bsd.netbsd.misc
Subject: Re: bind()ing a socket to a specific address?
Date: 7 Oct 1995 09:43:38 -0600
Organization: The Village
Lines: 16
Message-ID: <45677a$5e8@rover.village.org>
References: <45136o$6qf@wn1.sci.kun.nl> <453098$2gc@wn1.sci.kun.nl>
NNTP-Posting-Host: rover.village.org

In article <453098$2gc@wn1.sci.kun.nl>,
Olaf Seibert <rhialto@polder.ubc.kun.nl> wrote:
>I have been informed that I should zero the  struct sockaddr_in first.
>And indeed that does the trick. Apparently just copying the address
>from gethostbyname() is not full size.

The address from gethostbyname() is full size.  However, the
sockaddr_in has a field called sin_zero that must be zeros.  Some OSes
are lax and don't require it to be zero, while others are more strict
about this requirement.

Warner
-- 
Warner Losh		"VMS Forever"		home: imp@village.org
Cyberspace Development, Inc			work: imp@marketplace.com
Makers of TIA, The Internet Adapter.		http://marketplace.com/