The connections class, providing nPut / nGet
More...

Public Member Functions | |
| n2bConnection (BYVAL_AS_LONG, BYVAL_AS_ZSTRING_PTR_PTR) | |
| Create a connection. More... | |
| ~n2bConnection () | |
| Finish a connection. More... | |
| FUNCTION_AS_INTEGER | nPut (BYVAL_AS_STRING, BYVAL_AS_USHORT) |
Send a STRING over socket. More... | |
| FUNCTION_AS_INTEGER | nPut (BYVAL_AS_ANY_PTR, BYVAL_AS_INTEGER, BYVAL_AS_USHORT) |
| Send any data over socket. More... | |
| FUNCTION_AS_CONST_ZSTRING_CONST_PTR | nGet (BYREF_AS_STRING, BYVAL_AS_USHORT) |
| Receive data form socket. More... | |
Public Attributes | |
| ZSTRING_PTR_PTR | Errr |
Protected Attributes | |
| LONG | Sock |
| The socket number. More... | |
| fd_set | FdsR |
| File descriptor for read. More... | |
| fd_set | FdsW |
| File descriptor for write. More... | |
| timeval | Timeout |
| How long should we wait until network is ready. More... | |
The connections class, providing nPut / nGet
Do not create this class directly. It has to be constructed with a nettobacServer::nOpen() or a nettobacClient::nOpen() call. Data can get send or received to/from the peer with it.
See section n2bConnection for a list of possible error messages.
Definition at line 25 of file nettobac.bi.
| n2bConnection::n2bConnection | ( | BYVAL_AS_LONG | Socket, |
| BYVAL_AS_ZSTRING_PTR_PTR | Ep | ||
| ) |
Create a connection.
| Socket | the socket to use |
| Ep | the pointer for error messages |
This constructor checks the socket and sets some options for fast access.
Definition at line 24 of file nettobac.bas.
| n2bConnection::~n2bConnection | ( | ) |
Finish a connection.
This destructor closes the open socket, if any.
Definition at line 39 of file nettobac.bas.
| FUNCTION_AS_INTEGER n2bConnection::nPut | ( | BYVAL_AS_STRING | Dat, |
| BYVAL_AS_USHORT | ReTry = 100 |
||
| ) |
Send a STRING over socket.
| Dat | the data to send |
| ReTry | the number of re-tries when socket isn't ready |
This function sends a STRING variable to the peer, sending all bytes from parameter Dat.
The function waits until the socket is ready to send. The maximum waiting time can get specified by parameter ReTry in steps of 1 / 50 seconds.
ReTry = 0 specifies a single shot.Definition at line 61 of file nettobac.bas.

| FUNCTION_AS_INTEGER n2bConnection::nPut | ( | BYVAL_AS_ANY_PTR | Dat, |
| BYVAL_AS_INTEGER | Az, | ||
| BYVAL_AS_USHORT | ReTry = 100 |
||
| ) |
Send any data over socket.
| Dat | a pointer to the data in memory |
| Az | the number of bytes to send |
| ReTry | the number of re-tries when socket isn't ready |
This function sends data to the peer, reading Az number of bytes from the buffer Dat.
The function waits until the socket is ready to send. The maximum waiting time can get specified by parameter ReTry in steps of 1 / 50 seconds.
ReTry = 0 specifies a single shot.Definition at line 83 of file nettobac.bas.
| FUNCTION_AS_CONST_ZSTRING_CONST_PTR n2bConnection::nGet | ( | BYREF_AS_STRING | Res, |
| BYVAL_AS_USHORT | ReTry = 100 |
||
| ) |
Receive data form socket.
| Res | The STRING variable to append the downloaded bytes |
| ReTry | A counter to limit the number of re-tries |
This function receives data from the peer. The incomming bytes get appended to the result variable Res.
The function waits until the socket is ready to send before each chunk of data (1024 bytes). The waiting time can get limited by parameter ReTry in steps of 1 / 50 seconds.
ReTry and the number of chunks to send.ReTry = 0 specifies a single shot.Definition at line 124 of file nettobac.bas.

| ZSTRING_PTR_PTR n2bConnection::Errr |
Definition at line 32 of file nettobac.bi.
|
protected |
The socket number.
Definition at line 35 of file nettobac.bi.
|
protected |
File descriptor for read.
Definition at line 37 of file nettobac.bi.
|
protected |
File descriptor for write.
Definition at line 37 of file nettobac.bi.
|
protected |
How long should we wait until network is ready.
Definition at line 40 of file nettobac.bi.