wrapper class for managing TCP sockets.
More...
#include <TcpSocket.h>
Inherited by AzNetworking::TlsSocket.
wrapper class for managing TCP sockets.
◆ TcpSocket()
AzNetworking::TcpSocket::TcpSocket |
( |
SocketFd |
socketFd | ) |
|
Construct with an existing socket file descriptor.
- Parameters
-
socketFd | existing socket file descriptor, this TcpSocket instance will assume ownership |
◆ CloneAndTakeOwnership()
virtual TcpSocket* AzNetworking::TcpSocket::CloneAndTakeOwnership |
( |
| ) |
|
|
virtual |
Creates a new socket instance, transferring all ownership from the current instance to the new instance.
- Returns
- new socket instance
Reimplemented in AzNetworking::TlsSocket.
◆ Connect()
virtual bool AzNetworking::TcpSocket::Connect |
( |
const IpAddress & |
address, |
|
|
uint16_t |
localPort |
|
) |
| |
|
virtual |
Opens the TCP socket and connects to the requested remote address.
- Parameters
-
address | the remote endpoint to connect to |
localPort | the local port to open a connection from, 0 binds to any available port |
- Returns
- boolean true on success
Reimplemented in AzNetworking::TlsSocket.
◆ GetSocketFd()
SocketFd AzNetworking::TcpSocket::GetSocketFd |
( |
| ) |
const |
|
inline |
Returns the underlying socket file descriptor.
- Returns
- the underlying socket file descriptor
◆ IsEncrypted()
virtual bool AzNetworking::TcpSocket::IsEncrypted |
( |
| ) |
const |
|
virtual |
Returns true if this is an encrypted socket, false if not.
- Returns
- boolean true if this is an encrypted socket, false if not
Reimplemented in AzNetworking::TlsSocket.
◆ IsOpen()
bool AzNetworking::TcpSocket::IsOpen |
( |
| ) |
const |
|
inline |
Returns true if the socket is currently in an open state.
- Returns
- boolean true if the socket is in a connected state
◆ Listen()
virtual bool AzNetworking::TcpSocket::Listen |
( |
uint16_t |
port | ) |
|
|
virtual |
Opens the TCP socket and binds it in listen mode.
- Parameters
-
port | the port number to open the TCP socket and begin listening on, 0 will bind to any available port |
- Returns
- boolean true on success
Reimplemented in AzNetworking::TlsSocket.
◆ Receive()
int32_t AzNetworking::TcpSocket::Receive |
( |
uint8_t * |
outData, |
|
|
uint32_t |
size |
|
) |
| const |
Receives a payload from the TCP socket.
- Parameters
-
outAddress | on success, the address of the endpoint that sent the data |
outData | on success, address to write the received data to |
size | maximum size the output buffer supports for receiving |
- Returns
- number of bytes received, <= 0 on error
◆ Send()
int32_t AzNetworking::TcpSocket::Send |
( |
const uint8_t * |
data, |
|
|
uint32_t |
size |
|
) |
| const |
Sends a chunk of data to the connected endpoint.
- Parameters
-
address | the address to send the payload to |
data | pointer to the data to send |
size | size of the payload in bytes |
- Returns
- number of bytes sent, <= 0 on error
◆ SetSocketFd()
void AzNetworking::TcpSocket::SetSocketFd |
( |
SocketFd |
socketFd | ) |
|
|
inline |
Sets the underlying socket file descriptor.
- Parameters
-
socketFd | the new underlying socket file descriptor to use for this TcpSocket instance |
The documentation for this class was generated from the following files:
- Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpSocket.h
- Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpSocket.inl