133 [[nodiscard]]
Status send(
const void* data, std::size_t size,
IpAddress remoteAddress,
unsigned short remotePort);
158 std::size_t& received,
159 std::optional<IpAddress>& remoteAddress,
160 unsigned short& remotePort);
195 [[nodiscard]]
Status receive(
Packet& packet, std::optional<IpAddress>& remoteAddress,
unsigned short& remotePort);
#define SFML_NETWORK_API
Definition Export.hpp:42
Encapsulate an IPv4 network address.
Definition IpAddress.hpp:49
static const IpAddress Any
Value representing any address (0.0.0.0).
Definition IpAddress.hpp:168
Utility class to build blocks of data to transfer over the network.
Definition Packet.hpp:49
Status
Status codes that may be returned by socket functions.
Definition Socket.hpp:49
Socket(const Socket &)=delete
Deleted copy constructor.
Status bind(unsigned short port, IpAddress address=IpAddress::Any)
Bind the socket to a specific port.
void unbind()
Unbind the socket from the local port to which it is bound.
Status receive(void *data, std::size_t size, std::size_t &received, std::optional< IpAddress > &remoteAddress, unsigned short &remotePort)
Receive raw data from a remote peer.
Status receive(Packet &packet, std::optional< IpAddress > &remoteAddress, unsigned short &remotePort)
Receive a formatted packet of data from a remote peer.
unsigned short getLocalPort() const
Get the port to which the socket is bound locally.
Status send(const void *data, std::size_t size, IpAddress remoteAddress, unsigned short remotePort)
Send raw data to a remote peer.
static constexpr std::size_t MaxDatagramSize
The maximum number of bytes that can be sent in a single UDP datagram.
Definition UdpSocket.hpp:56
Status send(Packet &packet, IpAddress remoteAddress, unsigned short remotePort)
Send a formatted packet of data to a remote peer.
UdpSocket()
Default constructor.
Definition BlendMode.hpp:34