NAME

XAS::Lib::Net::Client - The network client interface for the XAS environment

SYNOPSIS

my $rpc = XAS::Lib::Net::Client->new(
  -port => 9505,
  -host => 'localhost',
};

DESCRIPTION

This module implements a simple text orientated network protocol. All "packets" will have an explicit "\015\012" appended. This delineates the "packets" and is network neutral. No attempt is made to decipher these "packets".

METHODS

new

This initializes the module and can take these parameters. It doesn't actually make a network connection.

-port

The port number to attach too.

-host

The host to use for the connection. This can be an IP address or a host name.

-timeout

An optional timeout, it defaults to 60 seconds.

-eol

An optional eol. The default is "\015\012". Which is network netural.

-tcp_keeplive

Turns on TCP keepalive for each connection.

connect

Connect to the defined socket.

disconnect

Disconnect from the defined socket.

put($buffer)

This writes a buffer to the socket. Returns the number of bytes written.

$buffer

The buffer to send over the socket.

puts($buffer)

This writes a buffer that is terminated with eol to the socket. Returns the number of bytes written.

$buffer

The buffer to send over the socket.

get($length)

This block reads data from the socket. A buffer is returned when it reaches $length or timeout.

$length

An optional length for the buffer. Defaults to 512 bytes.

gets

This reads a buffer delimited by the eol from the socket.

pending

This returns the size of the internal read buffer.

errno

A class method to return the error number.

errstr

A class method to return the error string.

SEE ALSO

XAS::Lib::Net::POE::Client
XAS::Lib::Net::Server
XAS

AUTHOR

Kevin L. Esteb, <kevin@kesteb.us>

Copyright (c) 2012-2015 Kevin L. Esteb

This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.