[VxW] VxWorks BSD Socket implementation compatibility question

Steve Mowbray steve_mowbray at hotmail.com
Sat May 3 15:03:47 PDT 2003


"Junichiro Hamaguchi" <hamajun at sbcglobal.net> wrote in message
news:mailman.127.1051949627.1469.vxwexplo at csg.lbl.gov...
>
> Hello,
>
> I'm not quite sure what you mean by Gnu C complier
> UNIX socket implementation.

GNU C v3.0.3 on SunOS 5.8 (Solaris 8)     &
GNU C v2.95.3 on CygWin  (DLL v1.3.12)

Both compilers have a "standard" socket programming library.

>
> VxWorks sockaddr_in and sockaddr are exactly same
> as any BSD implementation.  (except for very old BSD).

Maybe so but there is this minor difference between VxWorks v5.4 standard
socket library and the SunOS and CygWin versions - I am trying to work out
which is more exactly the same than the other.

As it stands socket code written for Solaris 8 and CygWin 1.3.xx is not
strictly portable to VxWorks 5.4 and vice versa - however VxWorks appears to
ignore the fact that 's.sa_len' (the extra byte in struct sockaddr) is not
set if it is omitted (not sure that this will be completely safe).

>
> If you need socket interface for AF_INET then you may
> want to fill sockaddr_in that will be overlay on sockaddr
> than filling sockaddr directly.  It is not technically impossible
> to fill sockaddr directly but most people simply fill
> sockaddr_in that is standard socket programming practice
> in my understanding.
>
> Please look at Chapter "Sockets under VxWorks in VxWorks"
> in Network Programmer's Guide or Steven's Unix Network
> Programming Vol.1.  You will find that vxWorks does not
> ask you anything special to use socket.  VxWorks may not
> support some of nice socket options introduced by other
> BSD/Linux implementations, but mostly maintains good
> compatibility against 4.4 BSD.
>
> HTH,
> -hama
>
> >Hi
> >
> >have just ported a BSD socket app to VxWorks and have just noticed this
> >minor quirk:
> >
> >VxWorks BSD socket implementation has the unsigned char member 'sa_len'
to
> >the structure 'sockaddr' and this is repeated as unsigned char member
> >'sin_len' in structure 'sockaddr_in'.
> >
> >The (GNU C compiler) UNIX BSD socket implementations I have used in the
past
> >do not have this member in their respective structures - my questions
are:
> >
> >1. Is this extra member required to be correctly set in VxWorks (my
ported
> >code seems happy without it - although I am now worried about unforseen
side
> >effects of not setting its value for each sockaddr_in variable) .
> >
> >2. Is it the GNU C compiler UNIX socket implementations that are
incomplete
> >or is it VxWorks that has deviated from the spec.
> >
> >Thanks in advance
> >Steve
> >
> >
> >_______________________________________________
> >VxWorks Users Group mailing list
> >VxWexplo at lbl.gov
> >http://www-csg.lbl.gov/vxworks/
>




More information about the VxWexplo mailing list