psock.dll

Classes:

Index

Common index


Class HostEntry

#module root.communication.tcpip
The HostEntry class is populated by the GetHostByName and 
GetHostByAddress methods
	Name		- official name of host
	Aliases	- alias list
	Addrtype	- host address type
	AddrList	- list of addresses

Class ServiceEntry

#module root.communication.tcpip
The ServiceEntry class is populated by the GetServByName, 
GetServByPort and GetPeerName methods 
	Name		- official name of service
	Aliases	- alias list
	Port		- port #
	Proto		- protocol to use

Class SocketAddress

#module root.communication.tcpip
The SocketAddress class is designed for passing the address to the 
methods of TCPDatagram and TCPStream classes which work with sockets
	Port		- port
	Address	- address as integer number

Methods:


SocketAddress::SocketAddress(int)

param Port;

Creates an address for receiving input diagram from the arbitrary 
source through the port specified via the Port parameter.

SocketAddress::SocketAddress(int, int)

param Address, Port;

Creates an address in order to work with the following pair (Address, Port)

SocketAddress::SocketAddress(void)

Creates an address for receiving arbitrary input diagram.

Class TCPDatagram : TCP_IP

#module root.communication.tcpip
The TCPDatagram class is designed for UDP protocol work.
Datagrams are transmitted without establishing paired association 
between the transmitter and receiver.

Methods:


TCPDatagram::GetMaxDatagram(void)

This method returns the maximal datagram size which 
is valid in the current system.

TCPDatagram::GetPeerName(void)

This method returns the HostEntry object which is populated 
with information about the computer from which the last data 
block was received by the Receive function.

TCPDatagram::OnReceive(void)

The event handler that notifies about data 
occurrence in the input buffer.

TCPDatagram::OnSend(void)

The event handler that notifies about free space
occurrence in the output buffer.

TCPDatagram::Receive(void)

param Len;

This method reads bytes (their number is specified via the Len 
parameter) from the input buffer. If the number of bytes in the 
buffer is less than the Len parameter then only actually received 
bytes are read. 
Returns the object of the String class.
The OnRead event handler is called if data appears in the input buffer.

TCPDatagram::Send(object SocketAddress, object String)

param Address, Data.

This method sends data specified via the Data parameter to the address 
specified via the Address parameter.
Data bringing is not guaranteed.
This method returns the number of bytes that were actually accepted 
for transmission.
The size of the maximal transmitted block can be determined by 
the GetMaxDatagram() method.
The OnWrite event handler is called if free space appears in the 
output buffer.

TCPDatagram::Send(object SocketAddress, object String, int, int)

param Address, Data, Offset, Len;

This method sends bytes (their number is specified via the Len 
parameter) parameter with the offset specified via the Offset 
parameter from data specified via the Data parameter to the 
address specified via the Address parameter.
Data bringing is not guaranteed.
This method returns the number of bytes that were actually 
accepted for transmission.
The size of the maximal transmitted block can be determined 
by the GetMaxDatagram()method.
The OnWrite event handler is called if free space appears in 
the output buffer.

TCPDatagram::TCPDatagram(int)

param PortNumber;

Creates a TCPDatagram for the port specified via the parameter.

TCPDatagram::TCPDatagram(void)

Constructor

TCPDatagram::~TCPDatagram(void)

Destructor

Class TCPStream : TCP_IP

#module root.communication.tcpip
The TCPStream class performs TCP protocol stream connection. 
In the descendant class it is necessary to override the event 
handlers - i.e. On... methods.
	In order to create a client it is necessary to create an 
object and call the Connect method.
	In order to create a server it is necessary to create an 
object and call the InitServer method. The OnAccept event handler 
is called when connection request is received.
If the server determines to accept the connection request then it 
has to call the Accept method. The Accept method returns an object 
of the TCPStream class which is connected to the client and the 
server object keeps listening to the network.

Methods:


TCPStream::Accept(void)

This method accepts the input call.
It is invoked only by the server socket on receiving the "connection 
request" event (OnAccept handler). 
This method returns the object of the same class as the class which 
called this method. This object is linked to the client that request 
the connection. The further interaction with the client is performed 
via the object which was returned by the Accept method. The server 
object keeps waiting for the input connection requests.

TCPStream::Connect(object SocketAddress)

param Address;

This method is called by the client-object in order 
to establish connection with server.
Returns the populated object of the HostEntry class 
when in the in-sync state.
Returns the task identifier that can be used when calling 
the CancelAsyncRequest method when in the out-of-sync state.
The OnConnect event handler is called upon the completion of the task. 

TCPStream::GetPeerName(void)

This method returns the HostEntry object which is populated with
information about the computer to which this object is linked.
It can be used by the object returned by the Accept method in 
order to ascertain the name of the client which requested the 
connection.

TCPStream::InitServer(object SocketAddress)

param SocketAddress;

Initiates server on the connection request receive from the port and 
address determined by the object which in turn is specified via the 
SocketAddress parameter.
If client's address is not determined then the TCPIP_INADDR_ANY 
constant can be used as the address.

TCPStream::InitServer(object SocketAddress, int)

param SocketAddress, NumberOfPendingCalls;

Initiates server on the connection request receive from the port and 
address determined by the object which in turn is specified via the 
SocketAddress parameter.
If client's address is not determined then the TCPIP_INADDR_ANY constant 
can be used as the address.
The NumberOfPendingCalls parameter must be within 1 to 5. It specifies 
the number of input requests which are enqueued for connection 
acceptance.

TCPStream::OnAccept(void)

The event handler that notifies about the connection request from a client.
This method calls the Accept() method for the TCPStream class. 
The obtained (new) object of the TCPStream class is added to the list 
in the variable of the Servers class.

TCPStream::OnClose(void)

The event handler that notifies about the connection closing-down.

TCPStream::OnConnect(void)

The event handler that notifies that server received the connection.

TCPStream::OnOutOfBound(void)

The event handler that notifies about the out of order data receiving.

TCPStream::OnRead(void)

The event handler that notifies when data appears in the input buffer.

TCPStream::OnWrite(void)

The event handler that notifies when free space appears in the output buffer.

TCPStream::Read(int)

param Len;

This method reads bytes (their number is specified via the Len parameter) 
from the input buffer. 
If the number of bytes in the buffer is less than the Len parameter then 
only actually received bytes are read. 
Returns the object of the String class.
When in the out-of-sync state the OnRead event handler is called if 
data appears in the input buffer.

TCPStream::Read(void)

This method reads the contents of the input buffer.
Returns the object of the String class.

TCPStream::ReceiveOOB(int)

This method reads bytes (their number is specified via the Len parameter) 
from data transmitted out of order. 
If the number of bytes in the buffer is less than the Len parameter then 
only actually received bytes are read. 
Returns the object of the String class.
When in the out-of-sync state the OnOutOfBound event handler is called 
if data appears in the input buffer.

TCPStream::Reset(void)

Recreates socket. Closes the connection.

TCPStream::SendOutOfBound(object String)

param Data;

This method sends data specified via the Data parameter out of order. 
If there are no enough space in the output buffer then the number 
of bytes determined by free space is accepted for transmission.
This method returns the number of bytes that were actually accepted 
for transmission.
When in the out-of-sync state the OnWrite event handler is called if 
free space appears in the output buffer.

TCPStream::SendOutOfBound(object String, int, int)

param Data, Offset, Len;

This method sends bytes (their number is specified via the Len parameter) 
with the offset specified via the Offset parameter from 
data specified via the Data parameter out of order. 
If there are no enough space in the output buffer then the number 
of bytes determined by free space is accepted for transmission.
This method returns the number of bytes that were actually accepted 
for transmission.
When in the out-of-sync state the OnWrite event handler is called if 
free space appears in the output buffer.

TCPStream::TCPStream(void)

Constructor.

TCPStream::Write(object String)

param Data;

This method sends data specified via the Data parameter 
to the stream connected with self. 
If there are no enough space in the output buffer then the number 
of bytes determined by free space is accepted for transmission.
This method returns the number of bytes that were actually accepted 
for transmission.
When in the out-of-sync state the OnWrite event handler is called if 
free space appears in the output buffer.

TCPStream::Write(object String, int, int)

param Data, Offset, Len;

This method sends bytes (their number is specified via the Len parameter) 
with the offset specified via the Offset parameter from 
data specified via the Data parameter to the stream connected with 
self. 
If there are no enough space in the output buffer then the number 
of bytes determined by free space is accepted for transmission.
This method returns the number of bytes that were actually accepted 
for transmission.
When in the out-of-sync state the OnWrite event handler is called if 
free space appears in the output buffer.

TCPStream::~TCPStream(void)

Destructor.

Class TCP_IP

#module root.communication.tcpip
The TCP_IP class allows to get information about network addresses 
and services. You should set the Sync field to TRUE in order to work 
in the in-sync state, by default the out-of-sync state is set.
When in the out-of-sync state the end of ordered tasks processing 
results in calling the event handlers - i.e. On... methods. By default,
handlers print out the received result.
In your application you should derive a descendant from the TCP_IP 
class and override event handler methods.

Methods:


TCP_IP::BroadCast(boolean)

param Enable;

Enables broadcast transmission (for datagrams only).

TCP_IP::CancelAsyncRequest(int)

param TaskID;

Breaks the out-of-sync task execution.
The task identifier is returned by methods of the GetXByY type in 
the out-of-sync state. 

TCP_IP::DontRoute(boolean)

param Enable;

Disables package routing.

TCP_IP::EnableLinger(boolean, int)

param Enable, TimeOut;

If Linger is enabled then the presence of non-transferred data in 
the output buffer is checked when destroying an object.
If data is present then system tries to transfer data during the time 
interval specified via the TimeOut parameter (in seconds) before 
closing the socket.
If Linger is illegal then the socket is closed immediately and all 
data in the output buffer is cleared.

TCP_IP::GetErrorString(int)

param ErrorCode;

Returns the description of the error code.

TCP_IP::GetHostByAddress(int)

param Address;

Finds information about a computer according to its network address.
Returns the populated object of the HostEntry class when in the in-
sync state.
Returns the task identifier that can be used when calling the 
CancelAsyncRequest method when in the out-of-sync state.
The OnGetHostBy event handler is called upon the completion of the task. 

TCP_IP::GetHostByName(object String)

param Name;

Finds information about a computer according to its network name.
Returns the populated object of the HostEntry class when in the in-
sync state.
Returns the task identifier that can be used when calling the 
CancelAsyncRequest method when in the out-of-sync state.
The OnGetHostBy event handler is called upon the completion of the task. 

TCP_IP::GetHostName(void)

Returns the network name of the local machine.

TCP_IP::GetLastError(void)

Returns the last error code.

TCP_IP::GetMaxSockets(void)

Returns the maximum number of sockets which can be opened in the 
system simultaneously.

TCP_IP::GetServByName(object String)

param Name;

Finds information about a service according to its name.
Returns the populated object of the ServiceEntry class when in the in-
sync state.
Returns the task identifier that can be used when calling the 
CancelAsyncRequest method when in the out-of-sync state.
The OnGetServiceBy event handler is called upon the completion of the task. 

TCP_IP::GetServByName(object String, object String)

param Name, Protocol;

Finds information about a service according to its name and protocol 
name ("TCP" or "UDP").
Returns the populated object of the ServiceEntry class when in the in-
sync state.
Returns the task identifier that can be used when calling the 
CancelAsyncRequest method when in the out-of-sync state.
The OnGetServiceBy event handler is called upon the completion of the task. 

TCP_IP::GetServByPort(int)

Finds information about a service according to port number.
Returns the populated object of the ServiceEntry class when in the in-
sync state.
Returns the task identifier that can be used when calling the 
CancelAsyncRequest method when in the out-of-sync state.
The OnGetServiceBy event handler is called upon the completion of the task. 

TCP_IP::GetServByPort(int, object String)

param Port, Protocol;

Finds information about a service according to port number and 
protocol name ("TCP" or "UDP").
Returns the populated object of the ServiceEntry class when in the in-
sync state.
Returns the task identifier that can be used when calling the 
CancelAsyncRequest method when in the out-of-sync state.
The OnGetServiceBy event handler is called upon the completion of the task. 

TCP_IP::GetSocketName(void)

Returns the SocketAddress class object which is populated with socket data.

TCP_IP::HostToNetInt(int)

param Value;

Converts the 32-bit integer number to the network format from the 
local machine format.

TCP_IP::HostToNetShortInt(int)

param Value;

Converts the 16-bit integer number to the network format from the 
local machine format.

TCP_IP::IntAddrToStr(int)

param Addr;

Converts integer number which represents the network address to string 
that contains the network address in the following format 
	127.000.000.001

TCP_IP::NetToHostInt(int)

param Value;

Converts the 32-bit integer number to the local machine format from 
the network format.

TCP_IP::NetToHostShortInt(int)

param Value;

Converts the 16-bit integer number to the local machine format from 
the network format.

TCP_IP::NoDelay(boolean)

param Enable;

Disables transmission delay before full package fill according to 
Nagle algorithm.

TCP_IP::OOBinLine(boolean)

param Enable;

Moves "out of turn" parcels transmission to the general data flow.

TCP_IP::OnAsyncCallError(int)

param ErrorCode;

The method-handler of the "error when performing the out-of-sync task" event.
The ERR_PSC_TCPIP_ERROR error is raised by default.

TCP_IP::OnGetHostBy(object HostEntry)

param HostEntry;

The method-handler of the "host information request" event.
Receives the populated object of the HostEntry class as the parameter.

TCP_IP::OnGetServiceBy(object ServiceEntry)

param ServiceEntry;

The method-handler of the "service information request" event.
Receives the populated object of the ServiceEntry class as the parameter.

TCP_IP::ReuseAddress(boolean)

param Enable;

Enables the connection of the second server socket to the occupied port.

TCP_IP::SetReciveBufferSize(int)

param BufferSize;

Sets the input buffer size.

TCP_IP::SetSendBufferSize(int)

param BufferSize;

Sets the output buffer size.

TCP_IP::StrAddrToInt(object String)

param Name;

Converts string that contains the network address in the following format 
	127.000.000.001
to integer number.

TCP_IP::TCP_IP(void)

Constructor.

TCP_IP::~TCP_IP(void)

Destructor.

Index: