home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd1.bin / zkuste / Perl / ActivePerl-5.6.0.613.msi / 䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥 / _1b6ea29d7f5bf6f89507d269e2e7ce40 < prev    next >
Text File  |  2000-03-23  |  7KB  |  177 lines

  1.  
  2. <HTML>
  3. <HEAD>
  4. <TITLE>IO::Socket::INET - Object interface for AF_INET domain sockets</TITLE>
  5. <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
  6. <LINK REV="made" HREF="mailto:">
  7. </HEAD>
  8.  
  9. <BODY>
  10. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  11. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  12. <STRONG><P CLASS=block> IO::Socket::INET - Object interface for AF_INET domain sockets</P></STRONG>
  13. </TD></TR>
  14. </TABLE>
  15.  
  16. <A NAME="__index__"></A>
  17. <!-- INDEX BEGIN -->
  18.  
  19. <UL>
  20.  
  21.     <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
  22.  
  23.     <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
  24.     <LI><A HREF="#description">DESCRIPTION</A></LI>
  25.     <LI><A HREF="#constructor">CONSTRUCTOR</A></LI>
  26.     <UL>
  27.  
  28.         <LI><A HREF="#methods">METHODS</A></LI>
  29.     </UL>
  30.  
  31.     <LI><A HREF="#see also">SEE ALSO</A></LI>
  32.     <LI><A HREF="#author">AUTHOR</A></LI>
  33.     <LI><A HREF="#copyright">COPYRIGHT</A></LI>
  34. </UL>
  35. <!-- INDEX END -->
  36.  
  37. <HR>
  38. <P>
  39. <H1><A NAME="name">NAME</A></H1>
  40. <P>IO::Socket::INET - Object interface for AF_INET domain sockets</P>
  41. <P>
  42. <HR>
  43. <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
  44. <UL>
  45. <LI>Linux</LI>
  46. <LI>Solaris</LI>
  47. <LI>Windows</LI>
  48. </UL>
  49. <HR>
  50. <H1><A NAME="synopsis">SYNOPSIS</A></H1>
  51. <PRE>
  52.     use IO::Socket::INET;</PRE>
  53. <P>
  54. <HR>
  55. <H1><A NAME="description">DESCRIPTION</A></H1>
  56. <P><CODE>IO::Socket::INET</CODE> provides an object interface to creating and using sockets
  57. in the AF_INET domain. It is built upon the <A HREF="../../../lib/IO/Socket.html">the IO::Socket manpage</A> interface and
  58. inherits all the methods defined by <A HREF="../../../lib/IO/Socket.html">the IO::Socket manpage</A>.</P>
  59. <P>
  60. <HR>
  61. <H1><A NAME="constructor">CONSTRUCTOR</A></H1>
  62. <DL>
  63. <DT><STRONG><A NAME="item_new">new ( [ARGS] )</A></STRONG><BR>
  64. <DD>
  65. Creates an <CODE>IO::Socket::INET</CODE> object, which is a reference to a
  66. newly created symbol (see the <CODE>Symbol</CODE> package). <A HREF="#item_new"><CODE>new</CODE></A>
  67. optionally takes arguments, these arguments are in key-value pairs.
  68. <P>In addition to the key-value pairs accepted by <A HREF="../../../lib/IO/Socket.html">the IO::Socket manpage</A>,
  69. <CODE>IO::Socket::INET</CODE> provides.</P>
  70. <PRE>
  71.     PeerAddr    Remote host address          <hostname>[:<port>]
  72.     PeerHost    Synonym for PeerAddr
  73.     PeerPort    Remote port or service       <service>[(<no>)] | <no>
  74.     LocalAddr   Local host bind address      hostname[:port]
  75.     LocalHost   Synonym for LocalAddr
  76.     LocalPort   Local host bind port         <service>[(<no>)] | <no>
  77.     Proto       Protocol name (or number)    "tcp" | "udp" | ...
  78.     Type        Socket type                  SOCK_STREAM | SOCK_DGRAM | ...
  79.     Listen      Queue size for listen
  80.     Reuse       Set SO_REUSEADDR before binding
  81.     Timeout     Timeout value for various operations
  82.     MultiHomed  Try all adresses for multi-homed hosts</PRE>
  83. <P>If <CODE>Listen</CODE> is defined then a listen socket is created, else if the
  84. socket type, which is derived from the protocol, is SOCK_STREAM then
  85. <A HREF="../../../lib/Pod/perlfunc.html#item_connect"><CODE>connect()</CODE></A> is called.</P>
  86. <P>Although it is not illegal, the use of <CODE>MultiHomed</CODE> on a socket
  87. which is in non-blocking mode is of little use. This is because the
  88. first connect will never fail with a timeout as the connaect call
  89. will not block.</P>
  90. <P>The <CODE>PeerAddr</CODE> can be a hostname or the IP-address on the
  91. ``xx.xx.xx.xx'' form.  The <CODE>PeerPort</CODE> can be a number or a symbolic
  92. service name.  The service name might be followed by a number in
  93. parenthesis which is used if the service is not known by the system.
  94. The <CODE>PeerPort</CODE> specification can also be embedded in the <CODE>PeerAddr</CODE>
  95. by preceding it with a ``:''.</P>
  96. <P>If <CODE>Proto</CODE> is not given and you specify a symbolic <CODE>PeerPort</CODE> port,
  97. then the constructor will try to derive <CODE>Proto</CODE> from the service
  98. name.  As a last resort <CODE>Proto</CODE> ``tcp'' is assumed.  The <CODE>Type</CODE>
  99. parameter will be deduced from <CODE>Proto</CODE> if not specified.</P>
  100. <P>If the constructor is only passed a single argument, it is assumed to
  101. be a <CODE>PeerAddr</CODE> specification.</P>
  102. <P>Examples:</P>
  103. <PRE>
  104.    $sock = IO::Socket::INET->new(PeerAddr => 'www.perl.org',
  105.                                  PeerPort => 'http(80)',
  106.                                  Proto    => 'tcp');</PRE>
  107. <PRE>
  108.    $sock = IO::Socket::INET->new(PeerAddr => 'localhost:smtp(25)');</PRE>
  109. <PRE>
  110.    $sock = IO::Socket::INET->new(Listen    => 5,
  111.                                  LocalAddr => 'localhost',
  112.                                  LocalPort => 9000,
  113.                                  Proto     => 'tcp');</PRE>
  114. <PRE>
  115.    $sock = IO::Socket::INET->new('127.0.0.1:25');</PRE>
  116. <PRE>
  117.  NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE</PRE>
  118. <P>As of VERSION 1.18 all IO::Socket objects have autoflush turned on
  119. by default. This was not the case with earlier releases.</P>
  120. <PRE>
  121.  NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE</PRE>
  122. <P></P></DL>
  123. <P>
  124. <H2><A NAME="methods">METHODS</A></H2>
  125. <DL>
  126. <DT><STRONG><A NAME="item_sockaddr">sockaddr ()</A></STRONG><BR>
  127. <DD>
  128. Return the address part of the sockaddr structure for the socket
  129. <P></P>
  130. <DT><STRONG><A NAME="item_sockport">sockport ()</A></STRONG><BR>
  131. <DD>
  132. Return the port number that the socket is using on the local host
  133. <P></P>
  134. <DT><STRONG><A NAME="item_sockhost">sockhost ()</A></STRONG><BR>
  135. <DD>
  136. Return the address part of the sockaddr structure for the socket in a
  137. text form xx.xx.xx.xx
  138. <P></P>
  139. <DT><STRONG><A NAME="item_peeraddr">peeraddr ()</A></STRONG><BR>
  140. <DD>
  141. Return the address part of the sockaddr structure for the socket on
  142. the peer host
  143. <P></P>
  144. <DT><STRONG><A NAME="item_peerport">peerport ()</A></STRONG><BR>
  145. <DD>
  146. Return the port number for the socket on the peer host.
  147. <P></P>
  148. <DT><STRONG><A NAME="item_peerhost">peerhost ()</A></STRONG><BR>
  149. <DD>
  150. Return the address part of the sockaddr structure for the socket on the
  151. peer host in a text form xx.xx.xx.xx
  152. <P></P></DL>
  153. <P>
  154. <HR>
  155. <H1><A NAME="see also">SEE ALSO</A></H1>
  156. <P><A HREF="../../../lib/Socket.html">the Socket manpage</A>, <A HREF="../../../lib/IO/Socket.html">the IO::Socket manpage</A></P>
  157. <P>
  158. <HR>
  159. <H1><A NAME="author">AUTHOR</A></H1>
  160. <P>Graham Barr. Currently maintained by the Perl Porters.  Please report all
  161. bugs to <<A HREF="mailto:perl5-porters@perl.org">perl5-porters@perl.org</A>>.</P>
  162. <P>
  163. <HR>
  164. <H1><A NAME="copyright">COPYRIGHT</A></H1>
  165. <P>Copyright (c) 1996-8 Graham Barr <<A HREF="mailto:gbarr@pobox.com">gbarr@pobox.com</A>>. All rights reserved.
  166. This program is free software; you can redistribute it and/or
  167. modify it under the same terms as Perl itself.</P>
  168. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  169. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  170. <STRONG><P CLASS=block> IO::Socket::INET - Object interface for AF_INET domain sockets</P></STRONG>
  171. </TD></TR>
  172. </TABLE>
  173.  
  174. </BODY>
  175.  
  176. </HTML>
  177.