NAME

cs::Net::TCP - handle TCP network connections


SYNOPSIS

use cs::Net::TCP;


DESCRIPTION

This module supplied facilities for dealing with TCP stream connections.


CONSTANTS

The follow flag constants should be ORed together to select the mode for the Serve method.

F_FORK

Fork a subprocess to handle connections.

F_ONCE

Return after handling a single connection.

F_SYNC

Wait for the forked child.

F_FORK2

Fork twice so children are orphans to avoid zombies when children need not be waited for. This flag implies F_FORK.


GENERAL FUNCTIONS

conn(host, port, localport)

Connect to the specified port on the specified host using the specified localport at this end. Normally localport is omitted an an arbitrary free local port is chosen. Returns the filehandle of the new socket.

service(port)

Listen for connection on the specified port. If omitted, port defaults to 0 and an arbitrary free port is chosen to listen on. Returns the file handle of the new socket.


OBJECT CREATION

new cs::Net::TCP port

Listen on the named port. If omitted, port defaults to 0, which should choose a free port.

new cs::Net::TCP host, port, localport

Connect to the port on the specified host using the local localport at this end. Normally localport is omitted, and an arbitrary free local port number is allocated.


OBJECT METHODS

Port()

Return the local port number of this socket.


AUTHOR

Cameron Simpson <cs@zip.com.au>