Public Member Functions

FBTCPIP Class Reference

This reference page is linked to from the following overview topics: Utility Classes.


Search for all occurrences

Detailed Description

TCP/IP class.

Definition at line 206 of file fbio.h.

#include <fbio.h>

Inheritance diagram for FBTCPIP:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 FBTCPIP ()
 Constructor.
bool Read (int pSocket, void *lpBuffer, int nNumberOfBytesToRead, int *lpNumberOfBytesRead=NULL)
 Read data from a network socket (non-blocking)
bool ReadBlocking (int pSocket, void *lpBuffer, int nNumberOfBytesToRead, int *lpNumberOfBytesRead=NULL, kULong pTimeOut=500)
 Read data from a network socket (blocking).
bool ReadDatagram (int pSocket, void *lpBuffer, int nNumberOfBytesToRead, int *lpNumberOfBytesRead=NULL, kULong *pAddr=NULL, unsigned short *pPort=NULL)
 Read datagram from a network socket.
bool Write (int pSocket, void *lpBuffer, int nNumberOfBytesToWrite, int *lpNumberOfBytesWritten=NULL)
 Write data to a network socket (non-blocking)
bool WriteBlocking (int pSocket, void *lpBuffer, int nNumberOfBytesToWrite, int *lpNumberOfBytesToWrite=NULL, kULong pTimeOut=500)
 Write data to a network socket (blocking)
bool WriteDatagram (int pSocket, void *lpBuffer, int nNumberOfBytesToWrite, int *lpNumberOfBytesToWrite, kULong pAddr, unsigned short pPort)
 Write a datagram to a network socket.
bool CreateSocket (int &pSocket, FBTCPIPSocketType pType, const char *pProtocol="ip", bool pNonBlocking=true)
 Create a network socket.
bool Bind (int &pSocket, kULong pAddr, int pPort=0)
 Bind a socket to an address.
bool Connect (int &pSocket, char *pAddr, int pPort)
 Connect to address pAddr, port pPort with socket pSocket.
bool CloseSocket (int &pSocket)
 Close a network socket.
int Listen (int pSocket, int pBackLog=1)
 Place socket in mode to receive data.
int Accept (int pSocket, kULong *pOutAddr=NULL)
 Accepts incoming port access.
int Select (int pSocket, bool pTestRead, bool pTestWrite, bool pTestError, kULong pTimeOutMilisecond=0)
 Test socket status.

Constructor & Destructor Documentation

FBTCPIP ( )

Constructor.


Member Function Documentation

bool Read ( int  pSocket,
void *  lpBuffer,
int  nNumberOfBytesToRead,
int *  lpNumberOfBytesRead = NULL 
)

Read data from a network socket (non-blocking)

Parameters:
pSocketNetwork socket.
Return values:
lpBufferBuffer to fill.
Parameters:
nNumberOfBytesToReadNumber of bytes to read.
Return values:
lpNumberOfBytesReadNumber of bytes actually read (if not at NULL).
Returns:
true if the number of bytes read is equal to the number of bytes requested.
bool ReadBlocking ( int  pSocket,
void *  lpBuffer,
int  nNumberOfBytesToRead,
int *  lpNumberOfBytesRead = NULL,
kULong  pTimeOut = 500 
)

Read data from a network socket (blocking).

Parameters:
pSocketNetwork socket.
Return values:
lpBufferBuffer to fill.
Parameters:
nNumberOfBytesToReadNumber of bytes to read.
Return values:
lpNumberOfBytesReadNumber of bytes actually read (if not at NULL).
Parameters:
pTimeOutTimeout for operation (default to DEFAULT_BLOCKING).
Returns:
true if the number of bytes read is equal to the number of bytes requested.
Warning:
This operation is blocking!
bool ReadDatagram ( int  pSocket,
void *  lpBuffer,
int  nNumberOfBytesToRead,
int *  lpNumberOfBytesRead = NULL,
kULong pAddr = NULL,
unsigned short *  pPort = NULL 
)

Read datagram from a network socket.

Parameters:
pSocketNetwork socket.
Return values:
lpBufferBuffer to fill.
Parameters:
nNumberOfBytesToReadNumber of bytes to read.
Return values:
lpNumberOfBytesReadNumber of bytes actually read (if not at NULL).
Parameters:
pAddrAddress to get datagram.
pPortPort to access at pAddr.
Returns:
true if the number of bytes read is equal to the number of bytes requested.
bool Write ( int  pSocket,
void *  lpBuffer,
int  nNumberOfBytesToWrite,
int *  lpNumberOfBytesWritten = NULL 
)

Write data to a network socket (non-blocking)

Parameters:
pSocketNetwork socket.
lpBufferBuffer to write.
nNumberOfBytesToWriteNumber of bytes to write.
Return values:
lpNumberOfBytesWrittenNumber of bytes actually written (if not at NULL).
Returns:
true if the number of bytes written is equal to the number of bytes to write.
bool WriteBlocking ( int  pSocket,
void *  lpBuffer,
int  nNumberOfBytesToWrite,
int *  lpNumberOfBytesToWrite = NULL,
kULong  pTimeOut = 500 
)

Write data to a network socket (blocking)

Parameters:
pSocketNetwork socket.
lpBufferBuffer to write.
nNumberOfBytesToWriteNumber of bytes to write.
Return values:
lpNumberOfBytesToWriteNumber of bytes actually written (if not at NULL).
Parameters:
pTimeOutTimeout for operation.
Returns:
true if the number of bytes written is equal to the number of bytes to write.
Warning:
This operation is blocking!
bool WriteDatagram ( int  pSocket,
void *  lpBuffer,
int  nNumberOfBytesToWrite,
int *  lpNumberOfBytesToWrite,
kULong  pAddr,
unsigned short  pPort 
)

Write a datagram to a network socket.

Parameters:
pSocketNetwork socket.
lpBufferBuffer to write.
nNumberOfBytesToWriteNumber of bytes to write.
Return values:
lpNumberOfBytesToWriteNumber of bytes actually written (if not at NULL).
Parameters:
pAddrAddress to write datagram.
pPortPort to access at pAddr.
Returns:
Number of bytes written.
bool CreateSocket ( int &  pSocket,
FBTCPIPSocketType  pType,
const char *  pProtocol = "ip",
bool  pNonBlocking = true 
)

Create a network socket.

Return values:
pSocketNetwork socket created.
Parameters:
pTypeType of network socket.
pProtocolProtocol to use to communicate.
pNonBlockingIs socket blocking or non-blocking?
Returns:
true if successful.
bool Bind ( int &  pSocket,
kULong  pAddr,
int  pPort = 0 
)

Bind a socket to an address.

Parameters:
pSocketNetwork socket.
pAddrAddress to bind socket to.
pPortPort of pAddr to bind.
Returns:
true if successful.
bool Connect ( int &  pSocket,
char *  pAddr,
int  pPort 
)

Connect to address pAddr, port pPort with socket pSocket.

Parameters:
pSocketNetwork socket.
pAddrAddress to connect to.
pPortPort at pAddr to use.
Returns:
true if successful.
bool CloseSocket ( int &  pSocket)

Close a network socket.

Parameters:
pSocketNetwork socket.
Returns:
true if successful.
int Listen ( int  pSocket,
int  pBackLog = 1 
)

Place socket in mode to receive data.

Parameters:
pSocketNetwork socket.
pBackLogMaximum length of the queue of pending connections (default is 1).
Returns:
Error code from operation (returns 0 if no error)
int Accept ( int  pSocket,
kULong pOutAddr = NULL 
)

Accepts incoming port access.

Parameters:
pSocketNetwork socket.
Return values:
pOutAddrBuffer receiving address of sender.
Returns:
Error code from operation (returns 0 if no error)
int Select ( int  pSocket,
bool  pTestRead,
bool  pTestWrite,
bool  pTestError,
kULong  pTimeOutMilisecond = 0 
)

Test socket status.

Parameters:
pSocketNetwork socket to test.
pTestReadTest for read?
pTestWriteTest for write?
pTestErrorTest for error?
pTimeOutMilisecondTimeout for operation.
Returns:
Error code from operation (returns 0 if no error)

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

FBTCPIP FBTCPIP FBTCPIP FBTCPIP FBTCPIP FBTCPIP FBTCPIP FBTCPIP FBTCPIP FBTCPIP
FBTCPIP FBTCPIP FBTCPIP FBTCPIP FBTCPIP FBTCPIP FBTCPIP FBTCPIP FBTCPIP FBTCPIP