Back to Browse

Socket Programming in C, C++ Part - 5 (setsockopt system call)

12.3K views
Feb 19, 2020
12:08

Welcome to the series of videos on socket programming with C/C++ In this video, I have discussed about the function setsockopt to set various socket options in C/C++ socket programming. Sometimes our requirement could be to let the socket resue the same address , port , protocol which is already in use by some other socket (use SO_REUSEADDR) and Sometimes our requirement could be to not let the socket resue the same address , port , protocol which is already in use by some other socket (SO_EXCLUSIVEADDRUSE). setsockopt can be useful in such situations. Apart from this, there are many other options like may need to receive the out of bound data or may need to send the KEEPALIVE messages. In all such situations, the answer is setsockopt function call. But, you just need to remember that you should call the function before the bind system/function call else it won't take effect!! For further and complete references, just visit: https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-setsockopt https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind

Download

0 formats

No download links available.

Socket Programming in C, C++ Part - 5 (setsockopt system call) | NatokHD