亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? socket.pm

?? perl 解釋器
?? PM
?? 第 1 頁 / 共 2 頁
字號:
# IO::Socket.pm
#
# Copyright (c) 1996 Graham Barr <Graham.Barr@tiuk.ti.com>. All rights
# reserved. This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.

package IO::Socket;

=head1 NAME

IO::Socket - Object interface to socket communications

=head1 SYNOPSIS

    use IO::Socket;

=head1 DESCRIPTION

C<IO::Socket> provides an object interface to creating and using sockets. It
is built upon the L<IO::Handle> interface and inherits all the methods defined
by L<IO::Handle>.

C<IO::Socket> only defines methods for those operations which are common to all
types of socket. Operations which are specified to a socket in a particular 
domain have methods defined in sub classes of C<IO::Socket>

C<IO::Socket> will export all functions (and constants) defined by L<Socket>.

=head1 CONSTRUCTOR

=over 4

=item new ( [ARGS] )

Creates an C<IO::Socket>, which is a reference to a
newly created symbol (see the C<Symbol> package). C<new>
optionally takes arguments, these arguments are in key-value pairs.
C<new> only looks for one key C<Domain> which tells new which domain
the socket will be in. All other arguments will be passed to the
configuration method of the package for that domain, See below.

C<IO::Socket>s will be in autoflush mode after creation.  Note that
versions of IO::Socket prior to 1.1603 (as shipped with Perl 5.004_04)
did not do this.   So if you need backward compatibility, you should
set autoflush explicitly.

=back

=head1 METHODS

See L<perlfunc> for complete descriptions of each of the following
supported C<IO::Socket> methods, which are just front ends for the
corresponding built-in functions:

    socket
    socketpair
    bind
    listen
    accept
    send
    recv
    peername (getpeername)
    sockname (getsockname)

Some methods take slightly different arguments to those defined in L<perlfunc>
in attempt to make the interface more flexible. These are

=over 4

=item accept([PKG])

perform the system call C<accept> on the socket and return a new object. The
new object will be created in the same class as the listen socket, unless
C<PKG> is specified. This object can be used to communicate with the client
that was trying to connect. In a scalar context the new socket is returned,
or undef upon failure. In an array context a two-element array is returned
containing the new socket and the peer address, the list will
be empty upon failure.

Additional methods that are provided are

=item timeout([VAL])

Set or get the timeout value associated with this socket. If called without
any arguments then the current setting is returned. If called with an argument
the current setting is changed and the previous value returned.

=item sockopt(OPT [, VAL])

Unified method to both set and get options in the SOL_SOCKET level. If called
with one argument then getsockopt is called, otherwise setsockopt is called.

=item sockdomain

Returns the numerical number for the socket domain type. For example, for
a AF_INET socket the value of &AF_INET will be returned.

=item socktype

Returns the numerical number for the socket type. For example, for
a SOCK_STREAM socket the value of &SOCK_STREAM will be returned.

=item protocol

Returns the numerical number for the protocol being used on the socket, if
known. If the protocol is unknown, as with an AF_UNIX socket, zero
is returned.

=back

=cut


require 5.000;

use Config;
use IO::Handle;
use Socket 1.3;
use Carp;
use strict;
use vars qw(@ISA $VERSION);
use Exporter;

@ISA = qw(IO::Handle);

$VERSION = "1.1603";

sub import {
    my $pkg = shift;
    my $callpkg = caller;
    Exporter::export 'Socket', $callpkg, @_;
}

sub new {
    my($class,%arg) = @_;
    my $fh = $class->SUPER::new();
    $fh->autoflush;

    ${*$fh}{'io_socket_timeout'} = delete $arg{Timeout};

    return scalar(%arg) ? $fh->configure(\%arg)
			: $fh;
}

my @domain2pkg = ();

sub register_domain {
    my($p,$d) = @_;
    $domain2pkg[$d] = $p;
}

sub configure {
    my($fh,$arg) = @_;
    my $domain = delete $arg->{Domain};

    croak 'IO::Socket: Cannot configure a generic socket'
	unless defined $domain;

    croak "IO::Socket: Unsupported socket domain"
	unless defined $domain2pkg[$domain];

    croak "IO::Socket: Cannot configure socket in domain '$domain'"
	unless ref($fh) eq "IO::Socket";

    bless($fh, $domain2pkg[$domain]);
    $fh->configure($arg);
}

sub socket {
    @_ == 4 or croak 'usage: $fh->socket(DOMAIN, TYPE, PROTOCOL)';
    my($fh,$domain,$type,$protocol) = @_;

    socket($fh,$domain,$type,$protocol) or
    	return undef;

    ${*$fh}{'io_socket_domain'} = $domain;
    ${*$fh}{'io_socket_type'}   = $type;
    ${*$fh}{'io_socket_proto'}  = $protocol;

    $fh;
}

sub socketpair {
    @_ == 4 || croak 'usage: IO::Socket->pair(DOMAIN, TYPE, PROTOCOL)';
    my($class,$domain,$type,$protocol) = @_;
    my $fh1 = $class->new();
    my $fh2 = $class->new();

    socketpair($fh1,$fh2,$domain,$type,$protocol) or
    	return ();

    ${*$fh1}{'io_socket_type'}  = ${*$fh2}{'io_socket_type'}  = $type;
    ${*$fh1}{'io_socket_proto'} = ${*$fh2}{'io_socket_proto'} = $protocol;

    ($fh1,$fh2);
}

sub connect {
    @_ == 2 || @_ == 3 or croak 'usage: $fh->connect(NAME) or $fh->connect(PORT, ADDR)';
    my $fh = shift;
    my $addr = @_ == 1 ? shift : sockaddr_in(@_);
    my $timeout = ${*$fh}{'io_socket_timeout'};
    local($SIG{ALRM}) = $timeout ? sub { undef $fh; }
				 : $SIG{ALRM} || 'DEFAULT';

     eval {
    	croak 'connect: Bad address'
    	    if(@_ == 2 && !defined $_[1]);

    	if($timeout) {
    	    defined $Config{d_alarm} && defined alarm($timeout) or
    	    	$timeout = 0;
    	}

	my $ok = connect($fh, $addr);

    	alarm(0)
    	    if($timeout);

	croak "connect: timeout"
	    unless defined $fh;

	undef $fh unless $ok;
    };

    $fh;
}

sub bind {
    @_ == 2 || @_ == 3 or croak 'usage: $fh->bind(NAME) or $fh->bind(PORT, ADDR)';
    my $fh = shift;
    my $addr = @_ == 1 ? shift : sockaddr_in(@_);

    return bind($fh, $addr) ? $fh
			    : undef;
}

sub listen {
    @_ >= 1 && @_ <= 2 or croak 'usage: $fh->listen([QUEUE])';
    my($fh,$queue) = @_;
    $queue = 5
	unless $queue && $queue > 0;

    return listen($fh, $queue) ? $fh
			       : undef;
}

sub accept {
    @_ == 1 || @_ == 2 or croak 'usage $fh->accept([PKG])';
    my $fh = shift;
    my $pkg = shift || $fh;
    my $timeout = ${*$fh}{'io_socket_timeout'};
    my $new = $pkg->new(Timeout => $timeout);
    my $peer = undef;

    eval {
    	if($timeout) {
    	    my $fdset = "";
    	    vec($fdset, $fh->fileno,1) = 1;
    	    croak "accept: timeout"
    	    	unless select($fdset,undef,undef,$timeout);
    	}
    	$peer = accept($new,$fh);
    };

    return wantarray ? defined $peer ? ($new, $peer)
    	    	    	    	     : () 
    	      	     : defined $peer ? $new
    	    	    	    	     : undef;
}

sub sockname {
    @_ == 1 or croak 'usage: $fh->sockname()';
    getsockname($_[0]);
}

sub peername {
    @_ == 1 or croak 'usage: $fh->peername()';
    my($fh) = @_;
    getpeername($fh)
      || ${*$fh}{'io_socket_peername'}
      || undef;
}

sub send {
    @_ >= 2 && @_ <= 4 or croak 'usage: $fh->send(BUF, [FLAGS, [TO]])';
    my $fh    = $_[0];
    my $flags = $_[2] || 0;
    my $peer  = $_[3] || $fh->peername;

    croak 'send: Cannot determine peer address'
	 unless($peer);

    my $r = defined(getpeername($fh))
	? send($fh, $_[1], $flags)
	: send($fh, $_[1], $flags, $peer);

    # remember who we send to, if it was sucessful
    ${*$fh}{'io_socket_peername'} = $peer
	if(@_ == 4 && defined $r);

    $r;
}

sub recv {
    @_ == 3 || @_ == 4 or croak 'usage: $fh->recv(BUF, LEN [, FLAGS])';
    my $sock  = $_[0];
    my $len   = $_[2];
    my $flags = $_[3] || 0;

    # remember who we recv'd from
    ${*$sock}{'io_socket_peername'} = recv($sock, $_[1]='', $len, $flags);
}


sub setsockopt {
    @_ == 4 or croak '$fh->setsockopt(LEVEL, OPTNAME)';
    setsockopt($_[0],$_[1],$_[2],$_[3]);
}

my $intsize = length(pack("i",0));

sub getsockopt {
    @_ == 3 or croak '$fh->getsockopt(LEVEL, OPTNAME)';
    my $r = getsockopt($_[0],$_[1],$_[2]);
    # Just a guess
    $r = unpack("i", $r)
	if(defined $r && length($r) == $intsize);
    $r;
}

sub sockopt {
    my $fh = shift;
    @_ == 1 ? $fh->getsockopt(SOL_SOCKET,@_)
	    : $fh->setsockopt(SOL_SOCKET,@_);
}

sub timeout {
    @_ == 1 || @_ == 2 or croak 'usage: $fh->timeout([VALUE])';
    my($fh,$val) = @_;
    my $r = ${*$fh}{'io_socket_timeout'} || undef;

    ${*$fh}{'io_socket_timeout'} = 0 + $val
	if(@_ == 2);

    $r;
}

sub sockdomain {
    @_ == 1 or croak 'usage: $fh->sockdomain()';
    my $fh = shift;
    ${*$fh}{'io_socket_domain'};
}

sub socktype {
    @_ == 1 or croak 'usage: $fh->socktype()';
    my $fh = shift;
    ${*$fh}{'io_socket_type'}
}

sub protocol {
    @_ == 1 or croak 'usage: $fh->protocol()';
    my($fh) = @_;
    ${*$fh}{'io_socket_protocol'};
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品v国产精品v日韩精品| 亚洲伦理在线精品| 国产精品乱码久久久久久| 亚洲高清免费视频| 国产精品1区二区.| 欧美日韩www| 日韩久久一区二区| 国产精品1024| 欧美一级电影网站| 亚洲一二三区在线观看| 97精品国产露脸对白| 精品久久久久久亚洲综合网| 亚洲乱码日产精品bd| 国产精品一区二区视频| 日韩女优av电影| 日本aⅴ精品一区二区三区| 色成人在线视频| 国产精品久久国产精麻豆99网站| 激情久久久久久久久久久久久久久久| 欧美日韩一区精品| 亚洲精品中文在线观看| 99精品国产视频| 中文字幕中文字幕在线一区 | 成人影视亚洲图片在线| 欧美一区二区人人喊爽| 日韩中文字幕不卡| 欧美精品18+| 午夜精品久久一牛影视| 欧美日韩一区二区三区四区| 亚洲国产精品精华液网站| 本田岬高潮一区二区三区| 国产精品嫩草久久久久| 成人爱爱电影网址| 中文字幕一区日韩精品欧美| 成人av网在线| 依依成人精品视频| 91豆麻精品91久久久久久| 一区二区在线看| 欧美在线|欧美| 日韩av高清在线观看| 欧美mv和日韩mv的网站| 国精品**一区二区三区在线蜜桃| 日韩一级视频免费观看在线| 久草热8精品视频在线观看| 欧美mv日韩mv国产网站app| 九九在线精品视频| 久久久精品蜜桃| 99re热视频这里只精品| 午夜精品久久一牛影视| 日韩欧美一区二区视频| 高清不卡一区二区在线| 一区二区在线观看不卡| 在线播放日韩导航| 国产一区二区导航在线播放| 最新不卡av在线| 欧美视频在线一区二区三区| 美女视频一区在线观看| 国产农村妇女毛片精品久久麻豆| 成人一区在线观看| 亚洲高清在线视频| 国产午夜精品一区二区三区视频| 色综合久久中文综合久久97| 日韩不卡在线观看日韩不卡视频| 国产清纯白嫩初高生在线观看91 | 久久久久久一二三区| 99国产精品国产精品久久| 亚洲图片欧美综合| 欧美精品一区二区三| 99精品视频一区二区三区| 蜜臀av一区二区三区| 国产精品乱人伦| 5566中文字幕一区二区电影| 福利一区二区在线| 美女尤物国产一区| 亚洲男人的天堂一区二区| 欧美成人免费网站| 色狠狠桃花综合| 成人免费视频app| 美女视频一区在线观看| 樱花影视一区二区| 欧美极品少妇xxxxⅹ高跟鞋 | 欧美三级日韩三级国产三级| 久久69国产一区二区蜜臀| 夜夜精品浪潮av一区二区三区 | 欧美狂野另类xxxxoooo| 国产91丝袜在线播放0| 日本不卡在线视频| 亚洲欧美日韩成人高清在线一区| 欧美精品 日韩| 欧美在线免费播放| 国产aⅴ综合色| 青青草国产精品97视觉盛宴| 亚洲人123区| 国产欧美一区二区三区在线老狼| 欧美乱妇一区二区三区不卡视频| av在线不卡网| 国产成人鲁色资源国产91色综| 三级影片在线观看欧美日韩一区二区 | 欧美日韩国产区一| 不卡视频在线观看| 国产精品一色哟哟哟| 久久99精品国产| 麻豆91在线看| 久久99国产精品免费网站| 婷婷丁香久久五月婷婷| 亚洲成人tv网| 亚洲成人资源在线| 五月综合激情网| 天天操天天色综合| 日欧美一区二区| 蜜桃视频第一区免费观看| 日本一不卡视频| 久久精品99久久久| 狠狠网亚洲精品| 激情都市一区二区| 国产成人免费在线观看不卡| 精品亚洲免费视频| 国产精品888| 99久久精品国产一区二区三区| 91最新地址在线播放| 99久久99久久综合| 色诱亚洲精品久久久久久| 色国产精品一区在线观看| 欧美日韩黄色影视| 7777精品伊人久久久大香线蕉经典版下载 | 亚洲精品国产成人久久av盗摄 | 久久aⅴ国产欧美74aaa| 麻豆精品国产传媒mv男同| 久久66热re国产| 丁香婷婷综合色啪| 91丨九色porny丨蝌蚪| 欧洲精品一区二区| 91精品国产麻豆国产自产在线| 精品国产亚洲在线| 中文字幕日韩av资源站| 夜夜揉揉日日人人青青一国产精品 | 国产在线播精品第三| 成人性生交大片免费| 欧美亚洲精品一区| 日韩欧美的一区| 国产精品亲子伦对白| 一区二区日韩av| 美女在线观看视频一区二区| 国产成人高清在线| 欧美亚洲免费在线一区| 精品日韩在线一区| 国产精品欧美极品| 亚洲高清在线视频| 国产成人免费视频网站高清观看视频| 91亚洲精品一区二区乱码| 欧美唯美清纯偷拍| 欧美成人乱码一区二区三区| 国产精品国产三级国产aⅴ原创| 亚洲自拍偷拍网站| 精品一区二区免费看| 一本大道久久a久久精二百| 7777精品伊人久久久大香线蕉完整版 | 综合激情网...| 久久精品国产亚洲aⅴ| 成人白浆超碰人人人人| 日韩欧美在线网站| 一区二区三区四区视频精品免费| 国产专区综合网| 欧美午夜影院一区| 国产精品污www在线观看| 丝瓜av网站精品一区二区 | 久久电影网站中文字幕| 色猫猫国产区一区二在线视频| 精品久久久久久久久久久院品网| 一区二区三区在线视频免费 | 欧美视频自拍偷拍| 国产精品天美传媒| 日本免费在线视频不卡一不卡二| av在线一区二区三区| 久久一区二区三区国产精品| 日韩精品久久理论片| 91天堂素人约啪| 国产日本一区二区| 国产麻豆日韩欧美久久| 欧美麻豆精品久久久久久| 一区二区三区日韩在线观看| 从欧美一区二区三区| 精品国产麻豆免费人成网站| 亚洲国产精品一区二区尤物区| av电影天堂一区二区在线| 久久久久久免费网| 久久99久久99| 欧美成人r级一区二区三区| 亚洲电影在线播放| 色呦呦日韩精品| 亚洲欧洲性图库| 成人高清免费观看| 国产精品网站导航| 国产精品18久久久久久久网站| 精品国产免费一区二区三区四区| 久久精品国产久精国产爱| 亚洲日本青草视频在线怡红院 | 国产精品―色哟哟| 国产精品99久久久久久有的能看 | 亚洲欧洲av一区二区三区久久|