GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Net::TCP(3) User Contributed Perl Documentation Net::TCP(3)

Net::TCP - TCP sockets interface module

    use Net::Gen;               # optional
    use Net::Inet;              # optional
    use Net::TCP;

The "Net::TCP" module provides services for TCP communications over sockets. It is layered atop the "Net::Inet" and "Net::Gen" modules, which are part of the same distribution.

The following methods are provided by the "Net::TCP" module itself, rather than just being inherited from "Net::Inet" or "Net::Gen".
new
Usage:

    $obj = new Net::TCP;
    $obj = new Net::TCP $host, $service;
    $obj = new Net::TCP \%parameters;
    $obj = new Net::TCP $host, $service, \%parameters;
    $obj = 'Net::TCP'->new();
    $obj = 'Net::TCP'->new($host, $service);
    $obj = 'Net::TCP'->new(\%parameters);
    $obj = 'Net::TCP'->new($host, $service, \%parameters);
    

Returns a newly-initialised object of the given class. If called for a derived class, no validation of the supplied parameters will be performed. (This is so that the derived class can add the parameter validation it needs to the object before allowing the validation.) Otherwise, it will cause the parameters to be validated by calling its "init" method, which "Net::TCP" inherits from "Net::Inet". In particular, this means that if both a host and a service are given, then an object will only be returned if a connect() call was successful (or is still in progress, if the object is non-blocking).

The examples above show the indirect object syntax which many prefer, as well as the guaranteed-to-be-safe static method call. There are occasional problems with the indirect object syntax, which tend to be rather obscure when encountered. See http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/1998-01/msg01674.html for details.

none.

These are the socket options known to the "Net::TCP" module itself:
"TCP_NODELAY" "TCP_MAXSEG" "TCP_RPTR2RXT"

There are no object parameters registered by the "Net::TCP" module itself.

Tieing of scalars to a TCP handle is supported by inheritance from the "TIESCALAR" method of "Net::Gen". That method only succeeds if a call to a "new" method results in an object for which the "isconnected" method returns true, which is why it is mentioned in connection with this module.

Example:

    tie $x,Net::TCP,0,'finger' or die;
    $x = "-s\015\012";
    print $y while defined($y = $x);
    untie $x;

This is an expensive re-implementation of finger -s on many machines.

Each assignment to the tied scalar is really a call to the "put" method (via the "STORE" method), and each read from the tied scalar is really a call to the "getline" method (via the "FETCH" method).

default
none
exportable
"TCPOPT_EOL" "TCPOPT_MAXSEG" "TCPOPT_NOP" "TCPOPT_WINDOW" "TCP_MAXSEG" "TCP_MAXWIN" "TCP_MAX_WINSHIFT" "TCP_MSS" "TCP_NODELAY" "TCP_RPTR2RXT" "TH_ACK" "TH_FIN" "TH_PUSH" "TH_RST" "TH_SYN" "TH_URG"
tags
The following :tags are available for grouping related exportable items:
:sockopts
"TCP_NODELAY" "TCP_MAXSEG" "TCP_RPTR2RXT"
:tcpoptions
"TCPOPT_EOL" "TCPOPT_MAXSEG" "TCPOPT_NOP" "TCPOPT_WINDOW"
:protocolvalues
"TCP_MAXWIN" "TCP_MAX_WINSHIFT" "TCP_MSS" "TH_ACK" "TH_FIN" "TH_PUSH" "TH_RST" "TH_SYN" "TH_URG"
:ALL
All of the above exportable items.

This module has been tested with threaded perls, and should be as thread-safe as perl itself. (As of 5.005_03 and 5.005_57, that's not all that safe just yet.) It also works with interpreter-based threads ('ithreads') in more recent perl releases.

Net::Inet(3), Net::Gen(3), Net::TCP::Server(3)

Spider Boardman <spidb@cpan.org>
2022-04-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.