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, 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:
pSocket Network socket.
Return values:
lpBuffer Buffer to fill.
Parameters:
nNumberOfBytesToRead Number of bytes to read.
Return values:
lpNumberOfBytesRead Number 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:
pSocket Network socket.
Return values:
lpBuffer Buffer to fill.
Parameters:
nNumberOfBytesToRead Number of bytes to read.
Return values:
lpNumberOfBytesRead Number of bytes actually read (if not at NULL).
Parameters:
pTimeOut Timeout 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:
pSocket Network socket.
Return values:
lpBuffer Buffer to fill.
Parameters:
nNumberOfBytesToRead Number of bytes to read.
Return values:
lpNumberOfBytesRead Number of bytes actually read (if not at NULL).
Parameters:
pAddr Address to get datagram.
pPort Port 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:
pSocket Network socket.
lpBuffer Buffer to write.
nNumberOfBytesToWrite Number of bytes to write.
Return values:
lpNumberOfBytesWritten Number 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:
pSocket Network socket.
lpBuffer Buffer to write.
nNumberOfBytesToWrite Number of bytes to write.
Return values:
lpNumberOfBytesToWrite Number of bytes actually written (if not at NULL).
Parameters:
pTimeOut Timeout 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:
pSocket Network socket.
lpBuffer Buffer to write.
nNumberOfBytesToWrite Number of bytes to write.
Return values:
lpNumberOfBytesToWrite Number of bytes actually written (if not at NULL).
Parameters:
pAddr Address to write datagram.
pPort Port to access at pAddr.
Returns:
Number of bytes written.
bool CreateSocket ( int &  pSocket,
FBTCPIPSocketType  pType,
char *  pProtocol = "ip",
bool  pNonBlocking = true 
)

Create a network socket.

Return values:
pSocket Network socket created.
Parameters:
pType Type of network socket.
pProtocol Protocol to use to communicate.
pNonBlocking Is 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:
pSocket Network socket.
pAddr Address to bind socket to.
pPort Port 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:
pSocket Network socket.
pAddr Address to connect to.
pPort Port at pAddr to use.
Returns:
true if successful.
bool CloseSocket ( int &  pSocket )

Close a network socket.

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

Place socket in mode to receive data.

Parameters:
pSocket Network socket.
pBackLog Maximum 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:
pSocket Network socket.
Return values:
pOutAddr Buffer 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:
pSocket Network socket to test.
pTestRead Test for read?
pTestWrite Test for write?
pTestError Test for error?
pTimeOutMilisecond Timeout 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