c4d_network.h File Reference

Classes

class  NetworkIpConnection
 

Functions

Bool WriteIpAddr (const NetworkIpAddr &addr, HyperFile *hf)
 
Bool ReadIpAddr (NetworkIpAddr &addr, HyperFile *hf)
 
Bool WriteIpAddrPort (const NetworkIpAddrPort &addr, HyperFile *hf)
 
Bool ReadIpAddrPort (NetworkIpAddrPort &addr, HyperFile *hf)
 
NetworkIpConnectionOpenOutgoing (const NetworkIpAddrPort &adr, BaseThread *thread=nullptr, Int connectTimeout=30, Int sessionTimeout=10, Bool useNagleAlgorithm=true, Int *error=nullptr)
 
NetworkIpConnectionOpenOutgoing (const maxon::String &adr, BaseThread *thread=nullptr, Int connectTimeout=30, Int sessionTimeout=10, Bool useNagleAlgorithm=true, Int *error=nullptr)
 
Int BytesInInputBuffer (NetworkIpConnection *ipc)
 
Int RecvBytes (NetworkIpConnection *ipc, void *buf, Int size)
 
Int SendBytes (NetworkIpConnection *ipc, const void *buf, Int size)
 
NetworkIpConnectionOpenListener (const NetworkIpAddrPort &adr, BaseThread *thread, Int sessionTimeout, Bool dontwait, Int *error)
 
NetworkIpConnectionOpenListener (const maxon::String &adr, BaseThread *thread, Int sessionTimeout, Bool useNagleAlgorithm, Int *error)
 
NetworkIpConnectionOpenWaitForIncoming (NetworkIpConnection *listener, BaseThread *connection, Int *error)
 
void KillConnection (NetworkIpConnection *&ipc)
 
void CloseConnection (NetworkIpConnection *&ipc)
 

Function Documentation

◆ WriteIpAddr()

Bool WriteIpAddr ( const NetworkIpAddr addr,
HyperFile hf 
)

◆ ReadIpAddr()

Bool ReadIpAddr ( NetworkIpAddr addr,
HyperFile hf 
)

◆ WriteIpAddrPort()

Bool WriteIpAddrPort ( const NetworkIpAddrPort addr,
HyperFile hf 
)

◆ ReadIpAddrPort()

Bool ReadIpAddrPort ( NetworkIpAddrPort addr,
HyperFile hf 
)

◆ OpenOutgoing() [1/2]

NetworkIpConnection* OpenOutgoing ( const NetworkIpAddrPort adr,
BaseThread thread = nullptr,
Int  connectTimeout = 30,
Int  sessionTimeout = 10,
Bool  useNagleAlgorithm = true,
Int error = nullptr 
)

Opens a connection. Supports IPv4.

Parameters
[in]adrThe destination address to connect to.
[in]threadThe thread to use for the connection. The caller owns the pointed thread.
[in]connectTimeoutThe timeout in seconds for the initial connection.
[in]sessionTimeoutThe timeout in seconds for receive and send operations.
[in]useNagleAlgorithmPass true to set the TCP/IP flag for TCP_NODELAY. For more information see http://msdn.microsoft.com/en-us/library/windows/desktop/ms740476(v=vs.85).aspx.
[in]errorAssigned error status if the connection failed. A value different than 0 indicates failure.
Returns
The IP connection object. Must be freed with CloseConnection(). The caller owns the pointed NetworkIpConnection.

◆ OpenOutgoing() [2/2]

NetworkIpConnection* OpenOutgoing ( const maxon::String adr,
BaseThread thread = nullptr,
Int  connectTimeout = 30,
Int  sessionTimeout = 10,
Bool  useNagleAlgorithm = true,
Int error = nullptr 
)

Opens a connection. Supports IPv4.

Parameters
[in]adrThe destination address to connect to (IPv4 address or host name).
[in]threadThe thread to use for the connection. The caller owns the pointed thread.
[in]connectTimeoutThe timeout in seconds for the initial connection.
[in]sessionTimeoutThe timeout in seconds for receive and send operations.
[in]useNagleAlgorithmPass true to set the TCP/IP flag for TCP_NODELAY. For more information see http://msdn.microsoft.com/en-us/library/windows/desktop/ms740476(v=vs.85).aspx.
[in]errorAssigned error status if the connection failed. A value different than 0 indicates failure.
Returns
The IP connection object. Must be freed with CloseConnection(). The caller owns the pointed NetworkIpConnection.

◆ BytesInInputBuffer()

Int BytesInInputBuffer ( NetworkIpConnection ipc)

Checks how many bytes are in the input buffer of an IP connection.

Parameters
[in]ipcThe IP connection to check. The caller owns the pointed NetworkIpConnection.
Returns
The number of bytes in the input buffer.

◆ RecvBytes()

Int RecvBytes ( NetworkIpConnection ipc,
void *  buf,
Int  size 
)

Reads the bytes from the IP connection ipc to buf.

Note
RecvBytes() will try to fill the buffer completely. If not enough data is received, it will run into a timeout and return zero. To prevent this, use BytesInInputBuffer().
Parameters
[in]ipcThe IP connection to read from. The caller owns the pointed NetworkIpConnection.
[in]bufThe buffer to read to. The caller owns the pointed buffer.
[in]sizeThe size of the buffer buf.
Returns
The number of bytes read.

◆ SendBytes()

Int SendBytes ( NetworkIpConnection ipc,
const void *  buf,
Int  size 
)

Sends the bytes from buf to the IP connection ipc.

Parameters
[in]ipcThe IP connection to send the bytes to. The caller owns the pointed NetworkIpConnection.
[in]bufThe buffer to send from. The caller owns the pointed buffer.
[in]sizeThe size of the buffer buf.
Returns
The number of bytes sent.

◆ OpenListener() [1/2]

NetworkIpConnection* OpenListener ( const NetworkIpAddrPort adr,
BaseThread thread,
Int  sessionTimeout,
Bool  dontwait,
Int error 
)

Opens an IP listener.

Parameters
[in]adrThe IP address of the network interface to use for the listener.
[in]threadThe thread to use for the connection. The caller owns the pointed thread.
[in]sessionTimeoutThe time after which the listener closes an unresponsive connection.
[in]dontwaitPass true to set the TCP/IP flag for TCP_NODELAY. For more information see http://msdn.microsoft.com/en-us/library/windows/desktop/ms740476(v=vs.85).aspx.
[in]errorAssigned error status if the connection failed. A value different than 0 indicates failure.
Returns
The IP connection object for the listener. Must be freed with CloseConnection(). The caller owns the pointed NetworkIpConnection.

◆ OpenListener() [2/2]

NetworkIpConnection* OpenListener ( const maxon::String adr,
BaseThread thread,
Int  sessionTimeout,
Bool  useNagleAlgorithm,
Int error 
)

Opens an IP listener.

Parameters
[in]adrThe IP address of the network interface to use for the listener.
[in]threadThe thread to use for the connection. The caller owns the pointed thread.
[in]sessionTimeoutThe time after which the listener closes an unresponsive connection.
[in]useNagleAlgorithmPass true to set the TCP/IP flag for TCP_NODELAY. For more information see http://msdn.microsoft.com/en-us/library/windows/desktop/ms740476(v=vs.85).aspx.
[in]errorAssigned error status if the connection failed. A value different than 0 indicates failure.
Returns
The IP connection object for the listener. Must be freed with CloseConnection(). The caller owns the pointed NetworkIpConnection.

◆ OpenWaitForIncoming()

NetworkIpConnection* OpenWaitForIncoming ( NetworkIpConnection listener,
BaseThread connection,
Int error 
)

Waits for an incoming connection to listener.

Parameters
[in]listenerThe listener IP connection to wait for. Needs to be freed with GeIpCloseConnection(). The caller owns the pointed NetworkIpConnection.
[in]connectionThe thread to use for the connection. The caller owns the pointed thread.
[in]errorAssigned error status if the connection failed. A value different than 0 indicates failure.
Returns
The IP connection object for the waiting connection. Must be freed with CloseConnection(). The caller owns the pointed NetworkIpConnection.

◆ KillConnection()

void KillConnection ( NetworkIpConnection *&  ipc)

Kills an IP connection.

Note
Calls End() for the connection thread.
Parameters
[in]ipcThe IP connection to kill. The caller owns the pointed NetworkIpConnection.

◆ CloseConnection()

void CloseConnection ( NetworkIpConnection *&  ipc)

Closes and frees an IP connection.

Parameters
[in]ipcThe IP connection to close. Assigned nullptr afterward. The caller owns the pointed NetworkIpConnection.