Richard J. Ross III
Richard J. Ross III

Reputation: 55583

SCTP missing include file on OSX?

I was messing around with sockets, and I wanted to test out using the SCTP protocol on my mac.

However, when I try to include the file netinet/sctp.h the compiler gives me a 'file not found' error.

So I did some digging, and sure enough, there is no include file for netinet/sctp.h on Mac OSX Lion. Why is that, when I can set up a socket with IPPROTO_SCTP, and it builds fine?

So, in summary, I have two questions:

Upvotes: 5

Views: 4492

Answers (2)

Pocket Rocket
Pocket Rocket

Reputation: 11

Looks like you could do

brew install libusrsctp

And you will see the installed header here, although it is probably a different implementation with a different name:

cat /usr/local/Cellar/libusrsctp/0.9.5.0/include/usrsctp.h

Upvotes: 1

Simon Urbanek
Simon Urbanek

Reputation: 13932

On Lion IPPROTO_SCTP is defined in netinet/in.h - that's why it worked just fine since you probably included netinet/in.h directly or indirectly. However, it is only present in Lion, not in any earlier OS X versions. (Note that netinet/sctp.h is not part of POSIX an I don't think it's portable)

Upvotes: 4

Related Questions