Reputation: 39
I am looking at some code and came across something like this..
class ThreadingUDPLLMNRServer(ThreadingMixIn, UDPServer):
def server_bind(self):
MADDR = "224.0.0.252"
self.socket.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
self.socket.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 255)
Join = self.socket.setsockopt(socket.IPPROTO_IP,socket.IP_ADD_MEMBERSHIP,socket.inet_aton(MADDR) + settings.Config.IP_aton)
...
The function in question is setsockopt()
. From my understanding if you call a function on something multiple times, it will just update it. But here I don't see why you would do this since nothing is checking after each call. By calling it multiple times is it just basically giving that socket more options and each call is basically adding that info to it?
Upvotes: 1
Views: 1127
Reputation: 40063
There are many socket options, some standardized more than others; each call is setting a different option on the socket.
Upvotes: 2