NetworkIpHandlerInterface Class Reference

#include <network_webserver.h>

Inheritance diagram for NetworkIpHandlerInterface:

详细描述

Interface to access more high level functions to read/send from NetworkConnectionRef. This functions are used by the web server to read and send data.

公共成员函数

MAXON_METHOD Result < void >  InitConnection (const NetworkConnectionRef &connection, const NetworkWebServerRef &webServer)
MAXON_METHOD NetworkConnectionRef  GetConnection () const
MAXON_METHOD NetworkWebServerRef  GetWebServer () const
MAXON_METHOD Result < void >  RecvBytes (const Block < Byte > &data)
MAXON_METHOD Result < Int RecvBytesEOS (const Block < Byte > &data)
MAXON_METHOD Result < void >  ReadLine ( String &str)
MAXON_METHOD Result < void >  SendBytes (const Block < const Byte > &buffer)
MAXON_FUNCTION Result < void >  SendString (const String &str, const StringEncodingRef &encoding=StringEncodings::Utf8(), Int size=-1)
MAXON_FUNCTION Result < void >  SendString (const CString &str, Int size=-1)
MAXON_METHOD Result < void >  FlushWriteBuffer ()

私有成员函数

  MAXON_INTERFACE ( NetworkIpHandlerInterface , MAXON_REFERENCE_NORMAL , "net.maxon.interface.networkiphandler")

成员函数文档编制

◆  MAXON_INTERFACE()

MAXON_INTERFACE ( NetworkIpHandlerInterface   ,
MAXON_REFERENCE_NORMAL   ,
"net.maxon.interface.networkiphandler"   
)
private

◆  InitConnection()

MAXON_METHOD Result <void> InitConnection ( const NetworkConnectionRef &  connection ,
const NetworkWebServerRef &  webServer  
)

Initializes the object with a NetworkConnectionRef. This might be an incoming or outgoing connection.

参数
[in] connection NetworkConnectionRef for low level ip access.
[in] webServer Optional parameter to a NetworkWebServerRef.
返回
True if the functions was successful.

◆  GetConnection()

MAXON_METHOD NetworkConnectionRef GetConnection ( ) const

Returns the NetworkConnectionRef connected to this object.

◆  GetWebServer()

MAXON_METHOD NetworkWebServerRef GetWebServer ( ) const

Returns the NetworkWebServerRef connected to this object. It may return nullptr if no server is set in this connection.

◆  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 the data to be received.
返回
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 the data to be received.
返回
Returns the number of bytes read or the error.

◆  ReadLine()

MAXON_METHOD Result <void> ReadLine ( String str )

Reads data up to the next return character in the stream.

参数
[out] str Reference to a string which receives the data.
返回
True if the functions was successful.

◆  SendBytes()

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

Sends data to the connection. Please note that you need to call FlushWriteBuffer() before the data goes out. The functions tries to cache as much as possible before sending each bit separately.

参数
[in] buffer Block with the data to send.
返回
True if the functions was successful.

◆  SendString() [1/2]

MAXON_FUNCTION Result <void> SendString ( const String str ,
const StringEncodingRef &  encoding = StringEncodings::Utf8() ,
Int   size = -1  
)

Sends a String . Please note that you need to call FlushWriteBuffer() before the data goes out. The functions tries to cache as much as possible before sending each bit separately.

参数
[in] str 数据 string to be send.
[in] encoding String encoding that should be used to convert into 8-bit chars.
[in] size -1 for the complete string. Otherwise the string is sent only with a shortened length.
返回
True if the functions was successful.

◆  SendString() [2/2]

MAXON_FUNCTION Result <void> SendString ( const CString str ,
Int   size = -1  
)

Sends a CString . Please note that you need to call FlushWriteBuffer() before the data goes out. The functions tries to cache as much as possible before sending each bit separately.

参数
[in] str 数据 string to be send.
[in] size -1 for the complete string. Otherwise the string is sent only with a shortened length.
返回
True if the functions was successful.

◆  FlushWriteBuffer()

MAXON_METHOD Result <void> FlushWriteBuffer ( )

Flushes the write cache and forces the data to be send out.

返回
True if the functions was successful.