1. 'sockaddr' type versus 'osockaddr', under linux & bsd... help!
I'm trying to port back to bsd a linux daemon that was ported to linux,
years ago.
I don't understand the difference between sockaddr and osockaddr
(apart from the fact that sockaddr begins with the length ... that's for
the structure difference ...). When should I use one or the other ?
Under linux (2.0.29), osockaddr, used in the program is defined to be
sockaddr, which is defined as
struct sockaddr
{
unsigned short sa_family; /* address family, AF_xxx */
char sa_data[14]; /* 14 bytes of protocol address */
Under bsd (netbsd), it appears that osockaddr is exactly the same thing
as below, but that sockaddr is
struct sockaddr {
u_char sa_len; /* total length */
u_char sa_family; /* address family */
char sa_data[14]; /* actually longer; address value */
The problem is that I can't use the short version all the time because
all socket functions (connect, sendto, bind ...) require a 'sockaddr *'.
Is it sufficient to use always the 'short' version (sockaddr under linux and
osockaddr under bsd) and to typecast for socket system calls ?
Probably not, because it seems that the 'old' protocol requires use of
htons and ntohs for sa_family... I guess it because old is 'u_char' and
new is 'unsigned short'.
Please help getting me out of this *mess* .... Thanks !
Please cc: by mail and post to the newsgroup. Thanks.
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2. Drive a windows95 application on a PC from a SUN station on SOLARIS.
3. News Article: BSD '3 times as popular as desktop Linux' - Apple
4. tk anyone?
5. Does the 'linux' command change how *BSD runs?
6. NewsMaestro Usenet Supertool
7. BSD 'adventure' for Linux
8. USB CD Writer (SuSE 7.3 PPC)
9. BSD, BSD or BSD?
10. kermit help: 'make bsd' and 'kermit vs watchdog'
11. BSD, BSD or BSD?