Symbian platform (C++)
SDK native APIs, runtime and tooling
Loading...
Searching...
No Matches
symbian::api::connectivity::TcpClient Class Reference

One connected IPv4 TCP stream backed by Symbian RSocket. More...

#include <cpp/symbian/api/include/symbian/api/connectivity/tcp_client.h>

Public Member Functions

 TcpClient (TcpClient &&other) noexcept
 
TcpClient & operator= (TcpClient &&other) noexcept
 
 TcpClient (const TcpClient &)=delete
 
TcpClient & operator= (const TcpClient &)=delete
 
 ~TcpClient ()
 
void Close ()
 Close on the owner thread; repeated calls are harmless.
 
absl::Status SetNoDelay (bool enabled=true)
 Disable Nagle buffering for interactive message transports.
 
absl::Status Send (std::span< const std::uint8_t > bytes, absl::Time deadline=absl::InfiniteFuture())
 Complete one native send request of at most 32 KiB by a deadline.
 
absl::StatusOr< std::size_t > Receive (std::span< std::uint8_t > bytes, absl::Time deadline=absl::InfiniteFuture())
 Receive at least one byte into a buffer of at most 32 KiB.
 

Static Public Member Functions

static absl::StatusOr< TcpClient > ConnectIpv4 (std::array< std::uint8_t, 4 > address, std::uint16_t port, absl::Time deadline=absl::InfiniteFuture())
 Connect to four IPv4 octets by an absolute deadline.
 
static absl::StatusOr< TcpClient > ConnectHost (std::string_view hostname, std::uint16_t port, absl::Time deadline=absl::InfiniteFuture())
 Resolve an ASCII DNS hostname and connect by one deadline.
 

Friends

class TcpListener
 
class ActiveTcpListener
 

Detailed Description

One connected IPv4 TCP stream backed by Symbian RSocket.

Connect, Send and Receive wait for native request completion. Use this worker-facing helper on one thread, including destruction. A finite deadline cancels and drains a pending native request on expiry. The native socket session and handle close when the object is destroyed.

Constructor & Destructor Documentation

◆ TcpClient() [1/2]

symbian::api::connectivity::TcpClient::TcpClient ( TcpClient &&  other)
noexcept

◆ TcpClient() [2/2]

symbian::api::connectivity::TcpClient::TcpClient ( const TcpClient &  )
delete

◆ ~TcpClient()

symbian::api::connectivity::TcpClient::~TcpClient ( )

Member Function Documentation

◆ Close()

void symbian::api::connectivity::TcpClient::Close ( )

Close on the owner thread; repeated calls are harmless.

◆ ConnectHost()

absl::StatusOr< TcpClient > symbian::api::connectivity::TcpClient::ConnectHost ( std::string_view  hostname,
std::uint16_t  port,
absl::Time  deadline = absl::InfiniteFuture() 
)
static

Resolve an ASCII DNS hostname and connect by one deadline.

Uses the native resolver, returning its first IPv4 result. International names must be supplied as ASCII A-labels. Resolution cancels and drains on expiry, like socket I/O. No resolver cache or scheduler is created.

◆ ConnectIpv4()

absl::StatusOr< TcpClient > symbian::api::connectivity::TcpClient::ConnectIpv4 ( std::array< std::uint8_t, 4 >  address,
std::uint16_t  port,
absl::Time  deadline = absl::InfiniteFuture() 
)
static

Connect to four IPv4 octets by an absolute deadline.

InfiniteFuture waits until the native request completes. A finite deadline cancels and drains the connect request on expiry.

◆ operator=() [1/2]

TcpClient & symbian::api::connectivity::TcpClient::operator= ( const TcpClient &  )
delete

◆ operator=() [2/2]

TcpClient & symbian::api::connectivity::TcpClient::operator= ( TcpClient &&  other)
noexcept

◆ Receive()

absl::StatusOr< std::size_t > symbian::api::connectivity::TcpClient::Receive ( std::span< std::uint8_t >  bytes,
absl::Time  deadline = absl::InfiniteFuture() 
)

Receive at least one byte into a buffer of at most 32 KiB.

The returned count is the number of bytes written. An empty span returns zero. Native EOF and disconnect results are returned as statuses. On expiry the pending read is cancelled and drained; the stream can be reused.

◆ Send()

absl::Status symbian::api::connectivity::TcpClient::Send ( std::span< const std::uint8_t >  bytes,
absl::Time  deadline = absl::InfiniteFuture() 
)

Complete one native send request of at most 32 KiB by a deadline.

The caller keeps bytes alive until this method returns. An empty span succeeds without a socket request. Expiry cancels and drains the pending send. Delivery may already have occurred; use an application acknowledgement when it matters. This synchronous API does not report partial progress.

◆ SetNoDelay()

absl::Status symbian::api::connectivity::TcpClient::SetNoDelay ( bool  enabled = true)

Disable Nagle buffering for interactive message transports.

Friends And Related Symbol Documentation

◆ ActiveTcpListener

friend class ActiveTcpListener
friend

◆ TcpListener

friend class TcpListener
friend

The documentation for this class was generated from the following files: