summaryrefslogtreecommitdiff
path: root/ext/IO
diff options
context:
space:
mode:
authorMax Baker <max@warped.org>2002-03-08 02:56:19 -0800
committerAbhijit Menon-Sen <ams@wiw.org>2002-03-11 03:06:59 +0000
commit3e3f5e61dbaf80be7bb6393d494e3662496818b6 (patch)
tree447815191c194c8d73e3f08115f5e965037f485a /ext/IO
parent602f51c4890435088875fecbb84b1e1dc2acacff (diff)
downloadperl-3e3f5e61dbaf80be7bb6393d494e3662496818b6.tar.gz
Re: [patch] IO::Socket::INET Broadcast patch
Message-Id: <20020308105619.A15039@warped.org> p4raw-id: //depot/perl@15153
Diffstat (limited to 'ext/IO')
-rw-r--r--ext/IO/lib/IO/Socket/INET.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/IO/lib/IO/Socket/INET.pm b/ext/IO/lib/IO/Socket/INET.pm
index 83efd09a58..f59c810bb4 100644
--- a/ext/IO/lib/IO/Socket/INET.pm
+++ b/ext/IO/lib/IO/Socket/INET.pm
@@ -159,6 +159,11 @@ sub configure {
return _error($sock, $!, "$!");
}
+ if ($arg->{Broadcast}) {
+ $sock->sockopt(SO_BROADCAST,1) or
+ return _error($sock, $!, "$!");
+ }
+
if($lport || ($laddr ne INADDR_ANY) || exists $arg->{Listen}) {
$sock->bind($lport || 0, $laddr) or
return _error($sock, $!, "$!");
@@ -309,6 +314,7 @@ C<IO::Socket::INET> provides.
ReuseAddr Set SO_REUSEADDR before binding
Reuse Set SO_REUSEADDR before binding (deprecated, prefer ReuseAddr)
ReusePort Set SO_REUSEPORT before binding
+ Broadcast Set SO_BROADCAST before binding
Timeout Timeout value for various operations
MultiHomed Try all adresses for multi-homed hosts
Blocking Determine if connection will be blocking mode
@@ -355,6 +361,12 @@ Examples:
$sock = IO::Socket::INET->new('127.0.0.1:25');
+ $sock = IO::Socket::INET->new(PeerPort => 9999,
+ PeerAddr => inet_ntoa(INADDR_BROADCAST),
+ Proto => udp,
+ LocalAddr => 'localhost',
+ Broadcast => 1 )
+ or die "Can't bind : $@\n";
NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE