Steve
Steve

Reputation: 11

Socket Programming UDP GetSocketOpt

A third Party library gives us just the created socket on which listen data. Now this socket can be udp or tcp,

I am not able to figure out which options to give to getsockopt to figure out whether the socket is udp or tcp.

SOL_SOCKET, SO_BROADCAST doesn't seem to serve this purpose.

Upvotes: 1

Views: 396

Answers (1)

WhirlWind
WhirlWind

Reputation: 14112

Try SO_TYPE. SOCK_DGRAM or SOCK_STREAM should be for UDP or TCP, respectively.

Upvotes: 1

Related Questions