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

preview_player
Показать описание
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:


Рекомендации по теме
Комментарии
Автор

Can server broadcast its reply to multiple clients and if possible then how can we program it.

Rakeshkumar-poyg
Автор

Hi,
From 5:40 you said that SO_REUSEADDR is used for reusing the same port.
What is the use for SO_REUSEPORT then ?

simeun
Автор

How can I use SO_REUSEPORT functionality in windows do we have any example?

srinathr
Автор

what is the main purpose of 3rd argumrn here

gopigopisetti
join shbcf.ru