# OpenBeOS Network Kit: R5 compatibility issues

Unfortunatly, R5 and sooner (net_server based) network stack development header file (/develop/headers/be/net/socket.h) definition of network structures and constantes are not BSD standard ones.
BONE, otherwise, try to follow at best these standards definitions which, in turn, break binary compatibility with R5 network apps compiled for R5 network stack.
Hence why you needs to link against libsocket.so, libbind.so and libbnetapi.so BONE apps instead of R5 libnet.so and libnetapi.so libraries...

So, here we are. By design, we must:

- Provide backward binary compatibility with old, non-standard, network definitions used by apps linked against R5 network stack;
- But use the standard/de-facto BSD network definitions, to increase Unix network apps ports ease under OpenBeOS.

Network definitions differences:

Item | R5 stack | BONE stack | OpenBeOS stack
--- | --- | --- | ---
socket.h header file | be/net/socket.h | be/bone/sys/socket.h | posix/sys/socket.h
SOCK_DGRAM | 1 | 2 | idem as BONE
SOCK_STREAM | 2 | 1 | idem as BONE
SOCK_RAW | not defined | 3 | idem as BONE
SOCK_MISC | not defined | 255 | idem as BONE
SOL_SOCKET | 1 | 0xffffffff | idem as BONE
SO_DEBUG | 1 | 0x00000004 | idem as BONE
SO_REUSEADDR | 2 | 0x00000040 | idem as BONE
SO_NONBLOCK | 3 | 0x40000009 | idem as BONE
SO_REUSEPORT | 4 | 0x00000080 | idem as BONE
SO_FIONREAD | 5 | ? | ?
sockaddr | `struct sockaddr { unsigned short sa_family; char sa_data[10]; };` | `struct sockaddr { uint8 sa_len; uint8 sa_family; uint8 sa_data[30]; };` | idem as BONE
closesocket() | defined | not defined | defined, call close()
in.h header file | be/net/netinet/in.h, which in turn include be/net/socket.h | be/bone/netinet/in.h | posix/netinet/in.h

###### Philippe Houdoin, January 2nd, 2004