c4d_network.h File Reference

Classes

class   NetworkIpConnection

函数

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)
NetworkIpConnection OpenOutgoing (const NetworkIpAddrPort &adr, BaseThread *thread=nullptr, Int connectTimeout=30, Int sessionTimeout=10, Bool useNagleAlgorithm=true, Int *error=nullptr)
NetworkIpConnection OpenOutgoing (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)
NetworkIpConnection OpenListener (const NetworkIpAddrPort &adr, BaseThread *thread, Int sessionTimeout, Bool dontwait, Int *error)
NetworkIpConnection OpenListener (const maxon::String &adr, BaseThread *thread, Int sessionTimeout, Bool useNagleAlgorithm, Int *error)
NetworkIpConnection OpenWaitForIncoming ( 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 .

参数
[in] adr The destination address to connect to.
[in] thread The thread to use for the connection. The caller owns the pointed thread.
[in] connectTimeout The timeout in seconds for the initial connection.
[in] sessionTimeout The timeout in seconds for receive and send operations.
[in] useNagleAlgorithm Pass 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] error Assigned error status if the connection failed. A value different than 0 indicates failure.
返回
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 .

参数
[in] adr The destination address to connect to ( IPv4 address or host name).
[in] thread The thread to use for the connection. The caller owns the pointed thread.
[in] connectTimeout The timeout in seconds for the initial connection.
[in] sessionTimeout The timeout in seconds for receive and send operations.
[in] useNagleAlgorithm Pass 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] error Assigned error status if the connection failed. A value different than 0 indicates failure.
返回
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.

参数
[in] ipc The IP connection to check. The caller owns the pointed NetworkIpConnection .
返回
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 .

注意
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() .
参数
[in] ipc The IP connection to read from. The caller owns the pointed NetworkIpConnection .
[in] buf The buffer to read to. The caller owns the pointed buffer.
[in] size The size of the buffer buf .
返回
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 .

参数
[in] ipc The IP connection to send the bytes to. The caller owns the pointed NetworkIpConnection .
[in] buf The buffer to send from. The caller owns the pointed buffer.
[in] size The size of the buffer buf .
返回
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.

参数
[in] adr The IP address of the network interface to use for the listener.
[in] thread The thread to use for the connection. The caller owns the pointed thread.
[in] sessionTimeout The time after which the listener closes an unresponsive connection.
[in] dontwait Pass 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] error Assigned error status if the connection failed. A value different than 0 indicates failure.
返回
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.

参数
[in] adr The IP address of the network interface to use for the listener.
[in] thread The thread to use for the connection. The caller owns the pointed thread.
[in] sessionTimeout The time after which the listener closes an unresponsive connection.
[in] useNagleAlgorithm Pass 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] error Assigned error status if the connection failed. A value different than 0 indicates failure.
返回
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.

参数
[in] listener The listener IP connection to wait for. Needs to be freed with GeIpCloseConnection(). The caller owns the pointed NetworkIpConnection .
[in] connection The thread to use for the connection. The caller owns the pointed thread.
[in] error Assigned error status if the connection failed. A value different than 0 indicates failure.
返回
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.

注意
Calls End() for the connection thread.
参数
[in] ipc The IP connection to kill. The caller owns the pointed NetworkIpConnection .

◆  CloseConnection()

void CloseConnection ( NetworkIpConnection *&  ipc )

Closes and frees an IP connection.

参数
[in] ipc The IP connection to close. Assigned nullptr afterward. The caller owns the pointed NetworkIpConnection .