network.endpoints.tcpip - Palamecia/mint GitHub Wiki
Module
load network.endpoints.tcpip
This module provides the Network.TcpIp class which implement the Network.EndPoint interface for the TCP/IP protocol.
Packages
Enums
Network.TcpSocketOption
This enum describes the options of a TCP endpoint's socket. The effetive value of the option code can depend on the current system.
Constant | Value | Description |
---|---|---|
MAXSEG | 0 |
TCP maximum segment size (number). |
NODELAY | 1 |
Disable Nagle algorithm (boolean). |
Classes
Network.TcpIp
This class provides an end point implementation for communication with a peer device using the TCP/IP protocol.
Inherits
Members
Modifiers | Member | Description |
---|---|---|
+ override const |
accept | Returns a new end point initialized for the next waiting connection if any; o... |
+ override const |
connect | Attempts to make a connection to the remote device. Returns true if connect... |
- @ |
g_lib | Global library handle. |
+ const |
getPort | Returns the TCP port number used by the end point. |
+ override const |
getSocketOption | Returns the value of the endpoint's socket option described by option . The ... |
+ override const |
listen | Tells the end point to listen for incoming connections. Returns true on suc... |
+ const |
new | Creates a new end point for the IP address descibed by address and the TCP ... |
- final |
port | Internal TCP port. |
+ override const |
read | Returns all available data received from the peer as an instance of Serialize... |
+ override const |
setSocketOption | Sets the value of the endpoint's socket option described by option to val ... |
+ override const |
write | Sends the data described by the data parameter to the peer. The data para... |
Descriptions
Network.TcpIp.accept
def (self)
Returns a new end point initialized for the next waiting connection
if any; otherwise returns none
. The waiting connection will then
be accepted and dequeued.
An instance of Exception.SocketError is raised on error.
Network.TcpIp.connect
def (self)
Attempts to make a connection to the remote device. Returns true
if
connection succed or if the connection request was successfully sent
and is waiting for acknowledgment; otherwise returns false
.
An instance of Exception.SocketError is raised on error.
Network.TcpIp.g_lib
lib ('libmint-network')
Global library handle.
Network.TcpIp.getPort
def (const self)
Returns the TCP port number used by the end point.
Network.TcpIp.getSocketOption
def (self, % option)
Returns the value of the endpoint's socket option described by
option
. The option
parameter must be a value of the
Network.TcpSocketOption, Network.IpV4SocketOption,
Network.IpV6SocketOption, Network.IpSocketOption or
Network.SocketOption enum. If the option is not supported by
the system, none
is returned;
An instance of Exception.SocketError is raised on error.
Network.TcpIp.listen
def (self, backlog = 1024)
Tells the end point to listen for incoming connections. Returns true
on success; otherwise returns false
. The backlog
parameter provides
the maximum number of waiting connection allowed before new connections
get rejected.
An instance of Exception.SocketError is raised on error.
Network.TcpIp.new
def (self, address, port)
Creates a new end point for the IP address descibed by address
and
the TCP port descibed by port
.
Network.TcpIp.port
0
Internal TCP port.
Network.TcpIp.read
def (self)
Returns all available data received from the peer as an instance of
Serializer.DataStream or none
if no data is available.
An instance of Exception.SocketError is raised on error.
Network.TcpIp.setSocketOption
def (self, % option, value)
Sets the value of the endpoint's socket option described by option
to value
. The option
parameter must be a value of the
Network.TcpSocketOption, Network.IpV4SocketOption,
Network.IpV6SocketOption, Network.IpSocketOption or
Network.SocketOption enum. Returns true
if the option is supported
by the system; otherwise returns false
.
An instance of Exception.SocketError is raised on error.
Network.TcpIp.write
def (self, data)
Sends the data described by the data
parameter to the peer. The
data
parameter must be an instance of Serializer.DataStream. Returns an
iteraror containing true
and the amount of sent data in bytes if
the data was successfully sent to the peer; otherwise returns
false
.
An instance of Exception.SocketError is raised on error.
Network.TcpSocketOption.MAXSEG
0
TCP maximum segment size (number).
Network.TcpSocketOption.NODELAY
1
Disable Nagle algorithm (boolean).