NetworkConnectionInterface Class Reference

#include <network_ip.h>

Inheritance diagram for NetworkConnectionInterface:

详细描述

This class offers basic network connection functions to read/send data and manage connections.

Classes

class   特性

公共成员函数

MAXON_METHOD Result < void >  CloseConnection ()
MAXON_METHOD Result < void >  KillConnection ()
MAXON_METHOD Result < Int BytesInInputBuffer ()
MAXON_METHOD Result < void >  RecvBytes (const Block < Byte > &data)
MAXON_METHOD Result < Int RecvBytesEOS (const Block < Byte > &data)
MAXON_METHOD Result < void >  SendBytes (const Block < const Byte > &buffer)
MAXON_METHOD Result < void >  FlushWriteBuffer ()
MAXON_METHOD Result < void >  ResetBuffers ()
MAXON_METHOD Int64   GetTransferedBytes () const
MAXON_METHOD NetworkIpAddrPort   GetRemoteAddr () const
MAXON_METHOD NetworkIpAddrPort   GetHostAddr () const
MAXON_METHOD SOCKET   GetSocket () const
MAXON_METHOD Result < void >  SetNonBlockingSocket ( Bool nonBlockingSocket)
MAXON_METHOD Bool   IsNonBlockingSocket () const
MAXON_METHOD Result < void >  SetUseNagleAlgorithm ( Bool useNagleAlgorithm)
MAXON_METHOD Bool   GetUseNagleAlgorithm () const
MAXON_METHOD Result < void >  SetTimeout ( TimeValue timeoutInSeconds)
MAXON_METHOD TimeValue   GetTimeout () const
MAXON_METHOD CONNECTIONTYPE   GetConnectionType () const
MAXON_METHOD void  SetConnectionType ( CONNECTIONTYPE type)
MAXON_METHOD void  SetThread (const ThreadRef &ref)
MAXON_METHOD String   GetProxyServerInfo () const
MAXON_METHOD void  SetProxyServerInfo (const String &proxyInfo)

私有成员函数

  MAXON_INTERFACE ( NetworkConnectionInterface , MAXON_REFERENCE_NORMAL , "net.maxon.interface.networkconnection")

成员函数文档编制

◆  MAXON_INTERFACE()

MAXON_INTERFACE ( NetworkConnectionInterface   ,
MAXON_REFERENCE_NORMAL   ,
"net.maxon.interface.networkconnection"   
)
private

◆  CloseConnection()

MAXON_METHOD Result <void> CloseConnection ( )

Closes a connection by closing the socket.

返回
OK on success.

◆  KillConnection()

MAXON_METHOD Result <void> KillConnection ( )

Killing a connection and canceling the connected threads.

◆  BytesInInputBuffer()

MAXON_METHOD Result < Int > BytesInInputBuffer ( )

Returns the number of bytes that is available in the receive buffer.

返回
Number of bytes available in the read stream. A value of -1 if an error occurred.

◆  RecvBytes()

MAXON_METHOD Result <void> RecvBytes ( const Block < Byte > &  data )

Reads the requested number of bytes from the connection. The function will not return before the number of requested bytes has been read or an error occurred.

参数
[in] data Block for data buffer with requested number of bytes to read.
返回
OK on success.

◆  RecvBytesEOS()

MAXON_METHOD Result < Int > RecvBytesEOS ( const Block < Byte > &  data )

Reads the requested number of bytes from the connection to the end of the stream. The function will not return before the number of requested bytes has been read, an error occurred or the stream has been closed.

参数
[in] data Block for data buffer with requested number of bytes to read.
返回
Returns the number of bytes read or the error.

◆  SendBytes()

MAXON_METHOD Result <void> SendBytes ( const Block < const Byte > &  buffer )

Sends the given number of bytes to the connection. The function will not return before the number of given bytes is sent or an error occurred. Full duplex connections will not flush the send buffer until FlushWriteBuffer() is called.

参数
[in] buffer Block with the data to send.
返回
OK on success.

◆  FlushWriteBuffer()

MAXON_METHOD Result <void> FlushWriteBuffer ( )

Flushes the write buffer and send the collected bytes to the network connection.

返回
OK on success.

◆  ResetBuffers()

MAXON_METHOD Result <void> ResetBuffers ( )

Empties the read and write buffer for the next connection. This can be useful if the connection is of type keep alive.

返回
OK on success.

◆  GetTransferedBytes()

MAXON_METHOD Int64 GetTransferedBytes ( ) const

Returns the number of transfered bytes. -1 if an error occurred.

◆  GetRemoteAddr()

MAXON_METHOD NetworkIpAddrPort GetRemoteAddr ( ) const

Returns the remote address of this connection.

◆  GetHostAddr()

MAXON_METHOD NetworkIpAddrPort GetHostAddr ( ) const

Returns the host address of this connection.

◆  GetSocket()

MAXON_METHOD SOCKET GetSocket ( ) const

◆  SetNonBlockingSocket()

MAXON_METHOD Result <void> SetNonBlockingSocket ( Bool   nonBlockingSocket )

TODO: (Seb) Comment.

◆  IsNonBlockingSocket()

MAXON_METHOD Bool IsNonBlockingSocket ( ) const

TODO: (Seb) Comment.

◆  SetUseNagleAlgorithm()

MAXON_METHOD Result <void> SetUseNagleAlgorithm ( Bool   useNagleAlgorithm )

TODO: (Seb) Comment.

◆  GetUseNagleAlgorithm()

MAXON_METHOD Bool GetUseNagleAlgorithm ( ) const

TODO: (Seb) Comment.

◆  SetTimeout()

MAXON_METHOD Result <void> SetTimeout ( TimeValue   timeoutInSeconds )

TODO: (Seb) Comment.

◆  GetTimeout()

MAXON_METHOD TimeValue GetTimeout ( ) const

TODO: (Seb) Comment.

◆  GetConnectionType()

MAXON_METHOD CONNECTIONTYPE GetConnectionType ( ) const

TODO: (Seb) Comment.

◆  SetConnectionType()

MAXON_METHOD void SetConnectionType ( CONNECTIONTYPE   type )

TODO: (Seb) Comment.

◆  SetThread()

MAXON_METHOD void SetThread ( const ThreadRef ref )

TODO: (Seb) Comment.

The current thread will always be checked for cancellation. You only have to set a thread if an additional thread should be checked for cancellation, too.

参数
[in] ref An optional thread which will be checked for cancellation.

◆  GetProxyServerInfo()

MAXON_METHOD String GetProxyServerInfo ( ) const

Returns the stored proxy server information the was set using SetProxyInfo(). The format of the string is "<<server>>:<<port>>".

◆  SetProxyServerInfo()

MAXON_METHOD void SetProxyServerInfo ( const String proxyInfo )

Sets the proxy server to for later use of GetProxyInfo().

参数
[in] proxyInfo Info to set. The format of the proxyInfo must be "<<server>>:<<port>>".