#include <SFML/Config.h>
#include <SFML/Network/IPAddress.h>
#include <SFML/Network/Packet.h>
#include <SFML/Network/SocketStatus.h>
Go to the source code of this file.
Typedefs | |
typedef sfSocketTCP | sfSocketTCP |
SocketTCP wraps a socket using TCP protocol to send data safely (but a bit slower). | |
Functions | |
CSFML_API sfSocketTCP * | sfSocketTCP_Create () |
Construct a new TCP socket. | |
CSFML_API void | sfSocketTCP_Destroy (sfSocketTCP *Socket) |
Destroy an existing TCP socket. | |
CSFML_API sfBool | sfSocketTCP_Connect (sfSocketTCP *Socket, unsigned short Port, sfIPAddress HostAddress) |
Connect a TCP socket to another computer on a specified port. | |
CSFML_API sfBool | sfSocketTCP_Listen (sfSocketTCP *Socket, unsigned short Port) |
Listen to a specified port for incoming data or connections. | |
CSFML_API sfSocketStatus | sfSocketTCP_Accept (sfSocketTCP *Socket, sfSocketTCP **Connected, sfIPAddress *Address) |
Wait for a connection (must be listening to a port). | |
CSFML_API sfSocketStatus | sfSocketTCP_Send (sfSocketTCP *Socket, const char *Data, size_t Size) |
Send an array of bytes to the host (must be connected first). | |
CSFML_API sfSocketStatus | sfSocketTCP_Receive (sfSocketTCP *Socket, char *Data, size_t MaxSize, size_t *SizeReceived) |
Receive an array of bytes from the host (must be connected first). | |
CSFML_API sfSocketStatus | sfSocketTCP_SendPacket (sfSocketTCP *Socket, sfPacket *Packet) |
Send a packet of data to the host (must be connected first). | |
CSFML_API sfSocketStatus | sfSocketTCP_ReceivePacket (sfSocketTCP *Socket, sfPacket *Packet) |
Receive a packet from the host (must be connected first). | |
CSFML_API sfBool | sfSocketTCP_IsValid (sfSocketTCP *Socket) |
Check if a socket is in a valid state ; this function can be called any time to check if the socket is OK. |
typedef struct sfSocketTCP sfSocketTCP |
SocketTCP wraps a socket using TCP protocol to send data safely (but a bit slower).
Definition at line 41 of file SocketTCP.h.
CSFML_API sfSocketStatus sfSocketTCP_Accept | ( | sfSocketTCP * | Socket, | |
sfSocketTCP ** | Connected, | |||
sfIPAddress * | Address | |||
) |
Wait for a connection (must be listening to a port).
This function is blocking, ie. it won't return before a connection has been accepted
Socket | : Socket to use for accepting | |
Connected | : Pointer to a socket pointer that will be filled with the connected client | |
Address | : Pointer to an address to fill with client infos |
CSFML_API sfBool sfSocketTCP_Connect | ( | sfSocketTCP * | Socket, | |
unsigned short | Port, | |||
sfIPAddress | HostAddress | |||
) |
Connect a TCP socket to another computer on a specified port.
Socket | : Socket to use for connecting | |
Port | : Port to use for transfers (warning : ports < 1024 are reserved) | |
HostAddress | : IP Address of the host to connect to |
CSFML_API sfSocketTCP* sfSocketTCP_Create | ( | ) |
Construct a new TCP socket.
CSFML_API void sfSocketTCP_Destroy | ( | sfSocketTCP * | Socket | ) |
Destroy an existing TCP socket.
Socket | : Socket to destroy |
CSFML_API sfBool sfSocketTCP_IsValid | ( | sfSocketTCP * | Socket | ) |
Check if a socket is in a valid state ; this function can be called any time to check if the socket is OK.
Socket | : Socket to check |
CSFML_API sfBool sfSocketTCP_Listen | ( | sfSocketTCP * | Socket, | |
unsigned short | Port | |||
) |
Listen to a specified port for incoming data or connections.
Socket | : Socket to use for listening | |
Port | : Port to listen to |
CSFML_API sfSocketStatus sfSocketTCP_Receive | ( | sfSocketTCP * | Socket, | |
char * | Data, | |||
size_t | MaxSize, | |||
size_t * | SizeReceived | |||
) |
Receive an array of bytes from the host (must be connected first).
Socket | : Socket to use for receiving | |
Data | : Pointer to a byte array to fill (make sure it is big enough) | |
MaxSize | : Maximum number of bytes to read | |
SizeReceived | : Number of bytes received |
CSFML_API sfSocketStatus sfSocketTCP_ReceivePacket | ( | sfSocketTCP * | Socket, | |
sfPacket * | Packet | |||
) |
Receive a packet from the host (must be connected first).
Socket | : Socket to use for receiving | |
Packet | : Packet to fill with received data |
CSFML_API sfSocketStatus sfSocketTCP_Send | ( | sfSocketTCP * | Socket, | |
const char * | Data, | |||
size_t | Size | |||
) |
Send an array of bytes to the host (must be connected first).
Socket | : Socket to use for sending | |
Data | : Pointer to the bytes to send | |
Size | : Number of bytes to send |
CSFML_API sfSocketStatus sfSocketTCP_SendPacket | ( | sfSocketTCP * | Socket, | |
sfPacket * | Packet | |||
) |
Send a packet of data to the host (must be connected first).
Socket | : Socket to use for sending | |
Packet | : Packet to send |