#include <SFML/Config.h>#include <SFML/Network/IPAddress.h>#include <SFML/Network/SocketStatus.h>#include <SFML/Network/Types.h>Go to the source code of this file.
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 void | sfSocketUDP_SetBlocking (sfSocketUDP *Socket, sfBool Blocking) |
| Change the blocking state of a 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, unsigned short *Port) |
| 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, unsigned short *Port) |
| 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. | |
| 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, | |||
| unsigned short * | Port | |||
| ) |
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 | |
| Port | : Port on which the remote computer sent the data |
| CSFML_API sfSocketStatus sfSocketUDP_ReceivePacket | ( | sfSocketUDP * | Socket, | |
| sfPacket * | Packet, | |||
| sfIPAddress * | Address, | |||
| unsigned short * | Port | |||
| ) |
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 | |
| Port | : Port on which the remote computer sent the data |
| 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 void sfSocketUDP_SetBlocking | ( | sfSocketUDP * | Socket, | |
| sfBool | Blocking | |||
| ) |
Change the blocking state of a UDP socket.
The default behaviour of a socket is blocking
| Socket | : Socket to modify | |
| Blocking | : Pass sfTrue to set the socket as blocking, or false for non-blocking |
| CSFML_API sfBool sfSocketUDP_Unbind | ( | sfSocketUDP * | Socket | ) |
Unbind a socket from its previous port, if any.
| Socket | : Socket to unbind |