0

Socket programming may have minor differences in different UNIX flavors (Linux, Solaris, FreeBSD, Mac OS, ...). For example, a program may run well under Linux, but not Solaris because Solaris doesn't provide a socket option. If you are lucky, you can refer it in the OS manual, but if not, this pitfall may cost you one day. These tips may not be obtained by one or two books, and they are the engineers' experience. I think these tips can help not only newbies but also experienced.

I hope we can share these tips. As an example, I will show the following tips in Solaris socket programming:

  1. Add the following link options: "-lresolv -lnsl -lsocket";
  2. Solaris doesn't provide socket options: SO_SNDTIMEO and SO_RCVTIMEO;(https://stackoverflow.com/questions/15264801/why-does-solaris-os-define-so-sndtimeo-and-so-rcvtimeo-socket-options-in-header)
  3. In SCTP programming. must call bind() before calling sctp_bindx();(sctp_bindx (Solaris sctp library) always return "Invalid argument")
  4. When calling shutdown() on a listen socket, it will cause ENOTCONN error.(Why shutdown a socket can't let the select() return?)

Could anyone provide other tips about socket programming in different UNIX flavors?

Community
  • 1
  • 1
Nan Xiao
  • 16,671
  • 18
  • 103
  • 164

1 Answers1

1

See Bishop et al., Rigorous specification and conformance testing techniques for network protocols, as applied to TCP/IP, UDP, and Sockets, University of Cambridge Computer Laboratory & NICTA, Canberra 2005, available in various places on the Web.

user207421
  • 305,947
  • 44
  • 307
  • 483