25#ifndef SFML_SOCKETTCP_HPP
26#define SFML_SOCKETTCP_HPP
31#include <SFML/Network/SocketHelper.hpp>
74 Socket::Status
Connect(
unsigned short Port,
const IPAddress& HostAddress,
float Timeout = 0.f);
84 bool Listen(
unsigned short Port);
107 Socket::Status
Send(
const char* Data, std::size_t Size);
120 Socket::Status
Receive(
char* Data, std::size_t MaxSize, std::size_t& SizeReceived);
168 bool operator ==(
const SocketTCP& Other)
const;
178 bool operator !=(
const SocketTCP& Other)
const;
190 bool operator <(
const SocketTCP& Other)
const;
203 SocketTCP(SocketHelper::SocketType Descriptor);
211 void Create(SocketHelper::SocketType Descriptor = 0);
216 SocketHelper::SocketType mySocket;
217 Uint32 myPendingHeader;
218 Uint32 myPendingHeaderSize;
219 std::vector<char> myPendingPacket;
220 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.
SocketTCP()
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...
bool Listen(unsigned short Port)
Listen to a specified port for incoming data or connections.
Socket::Status Receive(char *Data, std::size_t MaxSize, std::size_t &SizeReceived)
Receive an array of bytes from the host (must be connected first).
Socket::Status Send(const char *Data, std::size_t Size)
Send an array of bytes to the host (must be connected first).
bool Close()
Close the socket.
Socket::Status Accept(SocketTCP &Connected, IPAddress *Address=NULL)
Wait for a connection (must be listening to a port).
void SetBlocking(bool Blocking)
Change the blocking state of the socket.
Socket::Status Connect(unsigned short Port, const IPAddress &HostAddress, float Timeout=0.f)
Connect to another computer on a specified port.