On Fri, 3 May 2013 16:34:41 -0500 "Craig A. Berry" <craig.a.berry@gmail.com> wrote: > The first hunk in the attached patch does that. It also has a second > hunk, which is actually against IO::Socket, not IO::Socket:IP. It > turns out sockets on VMS (just like Windows) are blocking by default, > but the same code already in IO::Socket::blocking for Windows that > uses ioctl to set non-blocking works just fine on VMS. As far as I > can see, the only thing you did wrong was to provide better test > coverage than IO::Socket has :-). > > That gets all the IO::Socket::IP tests in the > smoke-me/rjbs/io-socket-ip branch passing on VMS. With Ricardo's > permission, I can push the IO::Socket change to blead; it's quite > safe since it simply enables code for VMS that wasn't previously run > and can't affect other platforms. Excellent, that sounds good. > I'm sorry it took me so long to put together this trivial patch; > things have been quite busy at $work and elsewhere lately. Oh that's quite alright - often it can take a while to gain the sudden insight that turns into a small oneline fix. > And the patch inline for human readability: > > --- cpan/IO-Socket-IP/t/11sockopts.t;-0 Wed Apr 24 10:51:26 2013 > +++ cpan/IO-Socket-IP/t/11sockopts.t Fri May 3 15:50:14 2013 > @@ -39,7 +39,9 @@ SKIP: { > ok( $sock->getsockopt( SOL_SOCKET, SO_REUSEPORT ), 'SO_REUSEPORT > set' ); } > > -{ > +SKIP: { > + skip "SO_BROADCAST requires elevated privileges on $^O", 1 if $^O > eq 'VMS'; > + > my $sock = IO::Socket::IP->new( > LocalHost => "127.0.0.1", > Type => SOCK_DGRAM, That sounds OK, but I wonder if we can provide a better detection method, so it doesn't have to rely on the OS name and instead it could detect whether SO_BROADCAST works at all. Maybe a short sequence of socket() and setsockopt() and detect for non-error? I'll have a hack at something. > --- dist/IO/lib/IO/Socket.pm;-0 Wed Apr 24 10:51:26 2013 > +++ dist/IO/lib/IO/Socket.pm Fri May 3 15:45:21 2013 > @@ -167,7 +167,7 @@ sub blocking { > my $sock = shift; > > return $sock->SUPER::blocking(@_) > - if $^O ne 'MSWin32'; > + if $^O ne 'MSWin32' && $^O ne 'VMS'; > > # Windows handles blocking differently > # That sounds good. I mean, non-ideal, but perhaps unavoidable, and in any case no worse than the previous code was anyway in terms of hardcoding OS names. -- Paul "LeoNerd" Evans leonerd@leonerd.org.uk ICQ# 4135350 | Registered Linux# 179460 http://www.leonerd.org.uk/Thread Previous | Thread Next