#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 sfSocketUDP | sfSocketUDP |
sfSocketUDP wraps a socket using UDP protocol to send data fastly (but with less safety) | |
Functions | |
CSFML_API sfSocketUDP * | sfSocketUDP_Create () |
Construct a new UDP socket. | |
CSFML_API void | sfSocketUDP_Destroy (sfSocketUDP *Socket) |
Destroy an existing UDP socket. | |
CSFML_API sfBool | sfSocketUDP_Bind (sfSocketUDP *Socket, unsigned short Port) |
Bind a socket to a specific port. | |
CSFML_API sfBool | sfSocketUDP_Unbind (sfSocketUDP *Socket) |
Unbind a socket from its previous port, if any. | |
CSFML_API sfSocketStatus | sfSocketUDP_Send (sfSocketUDP *Socket, const char *Data, size_t Size, sfIPAddress Address, unsigned short Port) |
Send an array of bytes. | |
CSFML_API sfSocketStatus | sfSocketUDP_Receive (sfSocketUDP *Socket, char *Data, size_t MaxSize, size_t *SizeReceived, sfIPAddress *Address) |
Receive an array of bytes. | |
CSFML_API sfSocketStatus | sfSocketUDP_SendPacket (sfSocketUDP *Socket, sfPacket *Packet, sfIPAddress Address, unsigned short Port) |
Send a packet of data. | |
CSFML_API sfSocketStatus | sfSocketUDP_ReceivePacket (sfSocketUDP *Socket, sfPacket *Packet, sfIPAddress *Address) |
Receive a packet. | |
CSFML_API sfBool | sfSocketUDP_IsValid (sfSocketUDP *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 sfSocketUDP sfSocketUDP |
sfSocketUDP wraps a socket using UDP protocol to send data fastly (but with less safety)
Definition at line 41 of file SocketUDP.h.
CSFML_API sfBool sfSocketUDP_Bind | ( | sfSocketUDP * | Socket, | |
unsigned short | Port | |||
) |
Bind a socket to a specific port.
Socket | : Socket to bind | |
Port | : Port to bind the socket to |
CSFML_API sfSocketUDP* sfSocketUDP_Create | ( | ) |
Construct a new UDP socket.
CSFML_API void sfSocketUDP_Destroy | ( | sfSocketUDP * | Socket | ) |
Destroy an existing UDP socket.
Socket | : Socket to destroy |
CSFML_API sfBool sfSocketUDP_IsValid | ( | sfSocketUDP * | 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 sfSocketStatus sfSocketUDP_Receive | ( | sfSocketUDP * | Socket, | |
char * | Data, | |||
size_t | MaxSize, | |||
size_t * | SizeReceived, | |||
sfIPAddress * | Address | |||
) |
Receive an array of bytes.
This function is blocking, ie. it won't return before some bytes have been received
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 | |
Address | : Address of the computer which sent the data |
CSFML_API sfSocketStatus sfSocketUDP_ReceivePacket | ( | sfSocketUDP * | Socket, | |
sfPacket * | Packet, | |||
sfIPAddress * | Address | |||
) |
Receive a packet.
This function is blocking, ie. it won't return before a packet is received
Socket | : Socket to use for receiving | |
Packet | : Packet to fill with received data | |
Address | : Address of the computer which sent the packet |
CSFML_API sfSocketStatus sfSocketUDP_Send | ( | sfSocketUDP * | Socket, | |
const char * | Data, | |||
size_t | Size, | |||
sfIPAddress | Address, | |||
unsigned short | Port | |||
) |
Send an array of bytes.
Socket | : Socket to use for sending | |
Data | : Pointer to the bytes to send | |
Size | : Number of bytes to send | |
Address | : Address of the computer to send the packet to | |
Port | : Port to use for communication |
CSFML_API sfSocketStatus sfSocketUDP_SendPacket | ( | sfSocketUDP * | Socket, | |
sfPacket * | Packet, | |||
sfIPAddress | Address, | |||
unsigned short | Port | |||
) |
Send a packet of data.
Socket | : Socket to use for sending | |
Packet | : Packet to send | |
Address | : Address of the computer to send the packet to | |
Port | : Port to use for communication |
CSFML_API sfBool sfSocketUDP_Unbind | ( | sfSocketUDP * | Socket | ) |
Unbind a socket from its previous port, if any.
Socket | : Socket to unbind |