NetworkTcpConnectionInterface Class Reference

#include <network_ip_tcp.h>

Inheritance diagram for NetworkTcpConnectionInterface:

详细描述

An asynchronous TCP connection.

Public Types

using  ReceiveCompletionHandler = Delegate < Result < void >( Result < void >, AioBuffer )>
using  SendCompletionHandler = Delegate < Result < void >( Result < void >)>
using  ConnectCompletionHandler = Delegate < Result < void >( Result < void >, NetworkTcpConnectionRef)>

公共成员函数

MAXON_METHOD Result < void >  Receive (const AioStatusRef &status, ReceiveCompletionHandler handler)
MAXON_METHOD Result < void >  Receive ( ReceiveCompletionHandler handler)
MAXON_METHOD Result < void >  Send (const AioStatusRef &status, AioBuffer data, SendCompletionHandler handler= DefaultSendCompletionHandler )
MAXON_METHOD Result < void >  Send ( AioBuffer data, SendCompletionHandler handler= DefaultSendCompletionHandler )
MAXON_METHOD NetworkIpAddrPort   GetLocalAddress () const
MAXON_METHOD NetworkIpAddrPort   GetRemoteAddress () const
MAXON_METHOD AioServiceRef  GetIoService () const
MAXON_METHOD JobQueueRef   GetJobQueue () const

静态公共成员函数

static Result < void >  DefaultSendCompletionHandler ( Result < void > res)

私有成员函数

  MAXON_INTERFACE ( NetworkTcpConnectionInterface , MAXON_REFERENCE_NORMAL , "net.maxon.interface.networktcpconnection")
-  Private Member Functions inherited from AioReaderInterface
MAXON_METHOD Result < void >  NotifyForRead ( SocketT sockfd, Result < void > result)
-  Private Member Functions inherited from AioWriterInterface
MAXON_METHOD Result < void >  NotifyForWrite ( SocketT sockfd, Result < void > result)

Member Typedef Documentation

◆  ReceiveCompletionHandler

using ReceiveCompletionHandler = Delegate < Result <void>( Result <void>, AioBuffer )>

◆  SendCompletionHandler

using SendCompletionHandler = Delegate < Result <void>( Result <void>)>

◆  ConnectCompletionHandler

using ConnectCompletionHandler = Delegate < Result <void>( Result <void>, NetworkTcpConnectionRef)>

成员函数文档编制

◆  MAXON_INTERFACE()

MAXON_INTERFACE ( NetworkTcpConnectionInterface   ,
MAXON_REFERENCE_NORMAL   ,
"net.maxon.interface.networktcpconnection"   
)
private

◆  DefaultSendCompletionHandler()

static Result <void> DefaultSendCompletionHandler ( Result < void >  res )
static

◆  Receive() [1/2]

MAXON_METHOD Result <void> Receive ( const AioStatusRef &  status ,
ReceiveCompletionHandler   handler  
)

Enqueues an asynchronous receive request. As soon as data has been received, the given handler delegate is called. A status instance can be used to synchronously wait on the operation and check its success.

参数
[in] status Status monitor for the operation.
[in] handler Handler delegate.
返回
True if the request has been enqueued, error otherwise.

◆  Receive() [2/2]

MAXON_METHOD Result <void> Receive ( ReceiveCompletionHandler   handler )

Equivalent to Receive(AioStatusRef(), handler).

◆  Send() [1/2]

MAXON_METHOD Result <void> Send ( const AioStatusRef &  status ,
AioBuffer   data ,
SendCompletionHandler   handler = DefaultSendCompletionHandler  
)

Enqueues an asynchronous send request. As soon as data has been sent, the given handler delegate is called. A status instance can be used to synchronously wait on the operation and check its success.

参数
[in] status Status monitor for the operation.
[in] data Buffer containing data to be sent.
[in] handler Handler delegate.
返回
True if the request has been enqueued, error otherwise.

◆  Send() [2/2]

MAXON_METHOD Result <void> Send ( AioBuffer   data ,
SendCompletionHandler   handler = DefaultSendCompletionHandler  
)

Equivalent to Send(AioStatusRef(), data, handler).

◆  GetLocalAddress()

MAXON_METHOD NetworkIpAddrPort GetLocalAddress ( ) const

Returns the address of the local endpoint of this connection.

◆  GetRemoteAddress()

MAXON_METHOD NetworkIpAddrPort GetRemoteAddress ( ) const

Returns the address of the remote endpoint of this connection.

◆  GetIoService()

MAXON_METHOD AioServiceRef GetIoService ( ) const

Returns the I/O service that processes I/O operations of this connection.

◆  GetJobQueue()

MAXON_METHOD JobQueueRef GetJobQueue ( ) const

Returns the job queue that runs completion handlers of this connection.