[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: diff. bet sockaddr & sockaddr_in ?



On Sat, 24 Mar 2001, Sunil V wrote:
> The definition of 'struct sockaddr' is in <sys/socket.h>.

I posted to the list after reading stevens only.  But unfortunately  Iam not
able to find the definition of "struct sockaddr" in sys/socket.h.  Instead it
contains something like this:
================================================
#ifdef __USE_BSD
/* This is the 4.3 BSD `struct sockaddr' format, which is used as wire
   format in the grotty old 4.3 `talk' protocol.  */
struct osockaddr
  {
    unsigned short int sa_family;
    unsigned char sa_data[14];
  };
#endif
======================================================

I finally found that "struct sockaddr" in <bits/socket.h> with the following
defn:

======================================================
/* Structure describing a generic socket address.  */
struct sockaddr
  {
    __SOCKADDR_COMMON (sa_);    /* Common data: address family and length.  */
    char sa_data[14];           /* Address data.  */
  };
=========================================================

anyway thanks sunil for the info.


>From: Binand Raj S. <binand@xxxxxxxxxxxxxxxxxxxxx>
>>And this sort of a thing was used in the BSD sockets API because it was
>designed before the void * generic pointer was introduced into C. The


Now, the thing is clear. thanks binand.

-- mks --