develooper Front page | perl.perl5.porters | Postings from January 2001

[PATCH] add ReusePort option to IO::Socket::INET for better multicast support (resend)

Thread Next
From:
Jeremy D. Zawodny
Date:
January 10, 2001 01:38
Subject:
[PATCH] add ReusePort option to IO::Socket::INET for better multicast support (resend)
Message ID:
20010110013813.B41744@yahoo-inc.com
This is related to the Socket.pm patch I just submitted. It adds a new
option (ReusePort, similar to Reuse which allows address reuse) to the
new() constructor of IO::Socket::INET.

One could make the argument that there should be a ReuseAddr parameter
so that it's more clear than having Reuse and ReusePort. But it's not
necessary, so I haven't made that change.

The end result is that Perl is a bit more multicast friendly.

Thanks,

Jeremy
-- 
Jeremy D. Zawodny, <jzawodn@yahoo-inc.com>
Technical Yahoo - Yahoo Finance
Desk: (408) 328-7878    Fax: (408) 530-5454
Cell: (408) 439-9951


--- ext/IO/lib/IO/Socket/INET.pm.orig	Tue Jan  9 23:27:09 2001
+++ ext/IO/lib/IO/Socket/INET.pm	Tue Jan  9 23:49:46 2001
@@ -156,6 +156,11 @@
 		    return _error($sock, $!, "$!");
 	}
 
+	if ($arg->{ReusePort}) {
+	    $sock->sockopt(SO_REUSEPORT,1) or
+		    return _error($sock, $!, "$!");
+	}
+
 	if($lport || ($laddr ne INADDR_ANY) || exists $arg->{Listen}) {
 	    $sock->bind($lport || 0, $laddr) or
 		    return _error($sock, $!, "$!");
@@ -303,6 +308,7 @@
     Type	Socket type                  SOCK_STREAM | SOCK_DGRAM | ...
     Listen	Queue size for listen
     Reuse	Set SO_REUSEADDR before binding
+    ReusePort	Set SO_REUSEPORT before binding
     Timeout	Timeout	value for various operations
     MultiHomed  Try all adresses for multi-homed hosts
 



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About