* the use sin_zero in sockaddr_in
@ 2011-02-21 16:11 prabhu
2011-02-21 16:17 ` Jose Celestino
0 siblings, 1 reply; 5+ messages in thread
From: prabhu @ 2011-02-21 16:11 UTC (permalink / raw)
To: kernelnewbies
Hi all,
Could anyone please explain the use *sin_zero in *sockaddr_in?
struct sockaddr_in{
short sin_family; /* AF_INET */
u_short sin_port; /* 16-bit port number */
/* network byte ordered */
struct in_addr sin_addr; /* 32-bit netid/hostid */
/* network byte ordered */
* char sin_zero[8]; /* unused */*
}
Thanks,
Prabhu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110221/b24bbcef/attachment.html
^ permalink raw reply [flat|nested] 5+ messages in thread* the use sin_zero in sockaddr_in
2011-02-21 16:11 the use sin_zero in sockaddr_in prabhu
@ 2011-02-21 16:17 ` Jose Celestino
2011-02-21 16:34 ` prabhu
0 siblings, 1 reply; 5+ messages in thread
From: Jose Celestino @ 2011-02-21 16:17 UTC (permalink / raw)
To: kernelnewbies
On Seg, 2011-02-21 at 21:41 +0530, prabhu wrote:
> Hi all,
>
> Could anyone please explain the use sin_zero in sockaddr_in?
>
Padding to allow for casting.
--
Jose Celestino | http://japc.uncovering.org/files/japc-pgpkey.asc
----------------------------------------------------------------
"Assumption is the Mother of Screw-Up" -- Mr. John Elwood Hale
^ permalink raw reply [flat|nested] 5+ messages in thread
* the use sin_zero in sockaddr_in
2011-02-21 16:17 ` Jose Celestino
@ 2011-02-21 16:34 ` prabhu
2011-02-21 16:41 ` Wick
2011-02-21 16:55 ` Wick
0 siblings, 2 replies; 5+ messages in thread
From: prabhu @ 2011-02-21 16:34 UTC (permalink / raw)
To: kernelnewbies
Jose Celestino wrote:
> On Seg, 2011-02-21 at 21:41 +0530, prabhu wrote:
>
>> Hi all,
>>
>> Could anyone please explain the use sin_zero in sockaddr_in?
>>
>>
>
> Padding to allow for casting.
>
>
Hi Jose,
Could u please elaborate little more... why we need this 8 byte padding.
My complete Question:
1. Actually total size of sockaddr_in is 16 byte and out of 16 byte why
we have to use 8 byte for padding.?
2. Do we use these 8 byte for any other usage for real time?
Thanks,
Prabhu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110221/9903a74b/attachment.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* the use sin_zero in sockaddr_in
2011-02-21 16:34 ` prabhu
@ 2011-02-21 16:41 ` Wick
2011-02-21 16:55 ` Wick
1 sibling, 0 replies; 5+ messages in thread
From: Wick @ 2011-02-21 16:41 UTC (permalink / raw)
To: kernelnewbies
On Tue, Feb 22, 2011 at 12:34 AM, prabhu <prabhum@msys-tech.com> wrote:
> Jose Celestino wrote:
>
> On Seg, 2011-02-21 at 21:41 +0530, prabhu wrote:
>
>
> Hi all,
>
> Could anyone please explain the use sin_zero in sockaddr_in?
>
>
>
> Padding to allow for casting.
>
>
>
> Hi Jose,
>
> Could u please elaborate little more... why we? need this 8 byte padding.
>
> My complete Question:
> 1. Actually total size of sockaddr_in is 16 byte and out of 16 byte why we
> have to use 8 byte for padding.?
> 2. Do we use these 8 byte for any other usage for real time?
Unix network programming chapter 3.2 says that, "The POSIX
specification requires
only three members in the structure: sin_family, sin_addr, and sin_port. It is
acceptable for a POSIX-compliant implementation to define additional structure
members, and this is normal for an Internet socket address structure. Almost all
implementations add the sin_zero member so that all socket address structures
are at least 16 bytes in size. "
It's kinda like structure padding, maybe reserved for extra fields in the
future. You will never use it, just as commented.
--
Wick
MSN/GTalk: izhangxc[AT]gmail.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* the use sin_zero in sockaddr_in
2011-02-21 16:34 ` prabhu
2011-02-21 16:41 ` Wick
@ 2011-02-21 16:55 ` Wick
1 sibling, 0 replies; 5+ messages in thread
From: Wick @ 2011-02-21 16:55 UTC (permalink / raw)
To: kernelnewbies
On Tue, Feb 22, 2011 at 12:34 AM, prabhu <prabhum@msys-tech.com> wrote:
> Jose Celestino wrote:
>
> On Seg, 2011-02-21 at 21:41 +0530, prabhu wrote:
>
>
> Hi all,
>
> Could anyone please explain the use sin_zero in sockaddr_in?
>
>
>
> Padding to allow for casting.
>
>
>
> Hi Jose,
>
> Could u please elaborate little more... why we? need this 8 byte padding.
>
> My complete Question:
> 1. Actually total size of sockaddr_in is 16 byte and out of 16 byte why we
> have to use 8 byte for padding.?
> 2. Do we use these 8 byte for any other usage for real time?
Unix network programming chapter 3.2 says that, "The POSIX specification
requires only three members in the structure: sin_family, sin_addr, and
sin_port. It is acceptable for a POSIX-compliant implementation to define
additional structure members, and this is normal for an Internet socket address
structure. Almost all implementations add the sin_zero member so that all socket
address structures are at least 16 bytes in size. "
It's kinda like structure padding, maybe reserved for extra fields in the
future. You will never use it, just as commented.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-02-21 16:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-21 16:11 the use sin_zero in sockaddr_in prabhu
2011-02-21 16:17 ` Jose Celestino
2011-02-21 16:34 ` prabhu
2011-02-21 16:41 ` Wick
2011-02-21 16:55 ` Wick
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.