25#ifndef SFML_SOCKETUDP_HPP
26#define SFML_SOCKETUDP_HPP
31#include <SFML/Network/SocketHelper.hpp>
72 bool Bind(
unsigned short Port);
93 Socket::Status
Send(
const char* Data, std::size_t Size,
const IPAddress& Address,
unsigned short Port);
108 Socket::Status
Receive(
char* Data, std::size_t MaxSize, std::size_t& SizeReceived,
IPAddress& Address,
unsigned short& Port);
158 unsigned short GetPort()
const;
168 bool operator ==(
const SocketUDP& Other)
const;
178 bool operator !=(
const SocketUDP& Other)
const;
190 bool operator <(
const SocketUDP& Other)
const;
203 SocketUDP(SocketHelper::SocketType Descriptor);
211 void Create(SocketHelper::SocketType Descriptor = 0);
216 SocketHelper::SocketType mySocket;
217 unsigned short myPort;
218 Uint32 myPendingHeader;
219 Uint32 myPendingHeaderSize;
220 std::vector<char> myPendingPacket;
221 Int32 myPendingPacketSize;
IPAddress provides easy manipulation of IP v4 addresses.
Packet wraps data to send / to receive through the network.
Selector allow reading from multiple sockets without blocking.
unsigned short GetPort() const
Get the port the socket is currently bound to.
void SetBlocking(bool Blocking)
Change the blocking state of the socket.
bool Bind(unsigned short Port)
Bind the socket to a specific port.
bool Unbind()
Unbind the socket from its previous port, if any.
SocketUDP()
Default constructor.
bool IsValid() const
Check if the socket is in a valid state ; this function can be called any time to check if the socket...
Socket::Status Send(const char *Data, std::size_t Size, const IPAddress &Address, unsigned short Port)
Send an array of bytes.
Socket::Status Receive(char *Data, std::size_t MaxSize, std::size_t &SizeReceived, IPAddress &Address, unsigned short &Port)
Receive an array of bytes.
bool Close()
Close the socket.