nettobac  0.0.0
Network features for FreeBASIC code
n2bFactory Class Referenceabstract

Utility class to handle n2bConnection pointers, providing nClose More...

Inheritance diagram for n2bFactory:
Collaboration diagram for n2bFactory:

Public Member Functions

 n2bFactory ()
 Constructor to open the socket. More...
 
virtual ~n2bFactory ()
 Destructor to close all opened connections and the socket. More...
 
abstract FUNCTION_AS_n2bConnection_PTR nOpen ()
 
FUNCTION_AS_CONST_ZSTRING_CONST_PTR nClose (BYVAL_AS_n2bConnection_PTR)
 Close a connection. More...
 

Public Attributes

ZSTRING_PTR Errr
 The common error message (NULL in case of no error) More...
 
n2bConnection_PTR Slots [ANY]
 The array to store open connections. More...
 

Protected Member Functions

FUNCTION_AS_n2bConnection_PTR slot (BYVAL_AS_LONG)
 Generate a new connection and add the instance to array Slots. More...
 

Protected Attributes

LONG Sock
 The socket to use. More...
 

Detailed Description

Utility class to handle n2bConnection pointers, providing nClose

The base class of the nettobac instances. It manages the connection instances and provides the methods to open connections, to collects their pointers in the array n2bFactory::Slots and to close a connection manualy. The destructor closes all remaining connections.

See section n2bFactory for a list of possible error messages.

Since
0.0.0

Definition at line 57 of file nettobac.bi.

Constructor & Destructor Documentation

n2bFactory::n2bFactory ( )

Constructor to open the socket.

The constructor opens a socket for the new instance (client or server) and checks the result.

Since
0.0.0

Definition at line 156 of file nettobac.bas.

n2bFactory::~n2bFactory ( )
virtual

Destructor to close all opened connections and the socket.

The destructor DELETEs all open connections and closes the socket opened in the constructor.

Since
0.0.0

Definition at line 169 of file nettobac.bas.

Member Function Documentation

abstract FUNCTION_AS_n2bConnection_PTR n2bFactory::nOpen ( )
pure virtual

Implemented in nettobacServer, and nettobacClient.

FUNCTION_AS_CONST_ZSTRING_CONST_PTR n2bFactory::nClose ( BYVAL_AS_n2bConnection_PTR  Con)

Close a connection.

Parameters
ConThe pointer to the connection instance
Returns
0 (zero) on success, an error message otherwise

Call this function in order to close a connection.

Note
The destructor n2bFactory::~n2bFactory() will close all remaining connections, so it's optional to call this function.
Since
0.0.0

Definition at line 208 of file nettobac.bas.

FUNCTION_AS_n2bConnection_PTR n2bFactory::slot ( BYVAL_AS_LONG  Socket)
protected

Generate a new connection and add the instance to array Slots.

Parameters
SocketThe socket number for that new connection
Returns
a pointer to the new connection

This function collects pointers to newly created connections in the array Slots, in order to auto DELETE the instances in the destructor. If you want to get rid of a connection before the destructor gets called, use method nClose().

Since
0.0.0

Definition at line 188 of file nettobac.bas.

Member Data Documentation

ZSTRING_PTR n2bFactory::Errr

The common error message (NULL in case of no error)

Definition at line 59 of file nettobac.bi.

n2bConnection_PTR n2bFactory::Slots[ANY]

The array to store open connections.

In case of a server instance use this array to scan over all open connections. See function doServer() for an example.

Definition at line 66 of file nettobac.bi.

LONG n2bFactory::Sock
protected

The socket to use.

Definition at line 72 of file nettobac.bi.


The documentation for this class was generated from the following files: