-# $OpenBSD: Client.pm,v 1.1.1.1 2013/01/03 17:36:37 bluhm Exp $
+# $OpenBSD: Client.pm,v 1.2 2021/12/12 10:56:49 bluhm Exp $
# Copyright (c) 2010-2012 Alexander Bluhm <bluhm@openbsd.org>
#
use Socket qw(IPPROTO_TCP TCP_NODELAY);
use Socket6;
use IO::Socket;
-use IO::Socket::INET6;
+use IO::Socket::IP -register;
sub new {
my $class = shift;
or croak "$class connect port not given";
if ($self->{bindaddr}) {
- my $cs = IO::Socket::INET6->new(
+ my $cs = IO::SocketIP->new(
Proto => $self->{protocol},
Domain => $self->{connectdomain},
- Blocking => ($self->{nonblocking} ? 0 : 1),
LocalAddr => $self->{bindaddr},
LocalPort => $self->{bindport},
) or die ref($self), " socket connect failed: $!";
sub child {
my $self = shift;
- my $cs = $self->{cs} || IO::Socket::INET6->new(
+ my $cs = $self->{cs} || IO::Socket->new(
Proto => $self->{protocol},
Domain => $self->{connectdomain},
- Blocking => ($self->{nonblocking} ? 0 : 1),
) or die ref($self), " socket connect failed: $!";
if ($self->{oobinline}) {
setsockopt($cs, SOL_SOCKET, SO_OOBINLINE, pack('i', 1))
print STDERR "connect peer: ",$cs->peerhost()," ",$cs->peerport(),"\n";
$self->{bindaddr} = $cs->sockhost();
$self->{bindport} = $cs->sockport();
+ if ($self->{nonblocking}) {
+ $cs->blocking(0)
+ or die ref($self), " set non-blocking connect failed: $!";
+ }
open(STDOUT, '>&', $cs)
or die ref($self), " dup STDOUT failed: $!";
-# $OpenBSD: Makefile.inc,v 1.6 2021/05/17 13:13:27 bluhm Exp $
+# $OpenBSD: Makefile.inc,v 1.7 2021/12/12 10:56:49 bluhm Exp $
# The following ports must be installed for the regression tests:
# p5-BSD-Socket-Splice perl interface to OpenBSD socket splicing
PERL_REQUIRE != perl -Mstrict -Mwarnings -e ' \
eval { require BSD::Socket::Splice } or print $@; \
- eval { require IO::Socket::INET6 } or print $@; \
eval { require Socket6 } or print $@; \
'
.if ! empty (PERL_REQUIRE) && ! defined (TARGETS)
-# $OpenBSD: Relay.pm,v 1.2 2017/11/07 22:06:17 bluhm Exp $
+# $OpenBSD: Relay.pm,v 1.3 2021/12/12 10:56:49 bluhm Exp $
# Copyright (c) 2010-2017 Alexander Bluhm <bluhm@openbsd.org>
#
use Socket qw(IPPROTO_TCP TCP_NODELAY);
use Socket6;
use IO::Socket;
-use IO::Socket::INET6;
+use IO::Socket::IP -register;
sub new {
my $class = shift;
or croak "$class connect addr not given";
$self->{connectport}
or croak "$class connect port not given";
- my $ls = IO::Socket::INET6->new(
+ my $ls = IO::Socket->new(
Proto => $self->{protocol},
ReuseAddr => 1,
Domain => $self->{listendomain},
print STDERR "accept peer: ",$as->peerhost()," ",
$as->peerport(),"\n";
}
- $as->blocking($self->{nonblocking} ? 0 : 1)
- or die ref($self), " non-blocking accept failed: $!";
+ if ($self->{nonblocking}) {
+ $as->blocking(0)
+ or die ref($self), " set non-blocking accept failed: $!";
+ }
open(STDIN, '<&', $as)
or die ref($self), " dup STDIN failed: $!";
and die ref($self), " select timeout";
}
- my $cs = IO::Socket::INET6->new(
+ my $cs = IO::Socket->new(
Proto => $self->{protocol},
Domain => $self->{connectdomain},
- Blocking => ($self->{nonblocking} ? 0 : 1),
) or die ref($self), " socket connect failed: $!";
if ($self->{oobinline}) {
setsockopt($cs, SOL_SOCKET, SO_OOBINLINE, pack('i', 1))
print STDERR "connect peer: ",$cs->peerhost()," ",$cs->peerport(),"\n";
$self->{bindaddr} = $cs->sockhost();
$self->{bindport} = $cs->sockport();
+ if ($self->{nonblocking}) {
+ $cs->blocking(0)
+ or die ref($self), " set non-blocking connect failed: $!";
+ }
open(STDOUT, '>&', $cs)
or die ref($self), " dup STDOUT failed: $!";
-# $OpenBSD: Server.pm,v 1.1.1.1 2013/01/03 17:36:38 bluhm Exp $
+# $OpenBSD: Server.pm,v 1.2 2021/12/12 10:56:49 bluhm Exp $
# Copyright (c) 2010 Alexander Bluhm <bluhm@openbsd.org>
#
use Socket qw(IPPROTO_TCP TCP_NODELAY);
use Socket6;
use IO::Socket;
-use IO::Socket::INET6;
+use IO::Socket::IP -register;
sub new {
my $class = shift;
$self->{protocol} ||= "tcp";
$self->{listendomain}
or croak "$class listen domain not given";
- my $ls = IO::Socket::INET6->new(
+ my $ls = IO::Socket->new(
Proto => $self->{protocol},
ReuseAddr => 1,
Domain => $self->{listendomain},
print STDERR "accept peer: ",$as->peerhost()," ",
$as->peerport(),"\n";
}
- $as->blocking($self->{nonblocking} ? 0 : 1)
- or die ref($self), " non-blocking accept failed: $!";
+ if ($self->{nonblocking}) {
+ $as->blocking(0)
+ or die ref($self), " set non-blocking accept failed: $!";
+ }
open(STDIN, '<&', $as)
or die ref($self), " dup STDIN failed: $!";