FS#86 - Rewrite the sockets API

Updated the API documentation of the whole network module
The system headers are no longer included by the sfml-network public headers

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1475 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-03-23 09:39:43 +00:00
parent a09ee0f9e3
commit 9280771665
66 changed files with 3976 additions and 2992 deletions

View file

@ -32,9 +32,10 @@
#include <SFML/System.h>
#include <SFML/Network/IpAddress.h>
#include <SFML/Network/Packet.h>
#include <SFML/Network/Selector.h>
#include <SFML/Network/SocketTCP.h>
#include <SFML/Network/SocketUDP.h>
#include <SFML/Network/SocketSelector.h>
#include <SFML/Network/TcpListener.h>
#include <SFML/Network/TcpSocket.h>
#include <SFML/Network/UdpSocket.h>
#endif // SFML_NETWORK_H

View file

@ -383,7 +383,7 @@ CSFML_API sfFtpResponse* sfFtp_ParentDirectory(sfFtp* ftp);
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
CSFML_API sfFtpResponse* sfFtp_MakeDirectory(sfFtp* ftp, const char* name);
CSFML_API sfFtpResponse* sfFtp_CreateDirectory(sfFtp* ftp, const char* name);
////////////////////////////////////////////////////////////
/// Remove an existing directory

View file

@ -123,7 +123,7 @@ CSFML_API void sfHttpRequest_SetMethod(sfHttpRequest* httpRequest, sfHttpMethod
/// \param URI : URI to request, local to the host
///
////////////////////////////////////////////////////////////
CSFML_API void sfHttpRequest_SetURI(sfHttpRequest* httpRequest, const char* URI);
CSFML_API void sfHttpRequest_SetUri(sfHttpRequest* httpRequest, const char* uri);
////////////////////////////////////////////////////////////
/// Set the HTTP version of the request.

View file

@ -22,8 +22,8 @@
//
////////////////////////////////////////////////////////////
#ifndef SFML_SELECTOR_H
#define SFML_SELECTOR_H
#ifndef SFML_SOCKETSELECTOR_H
#define SFML_SOCKETSELECTOR_H
////////////////////////////////////////////////////////////
// Headers
@ -38,8 +38,7 @@
/// \return A new sfSelector object
///
////////////////////////////////////////////////////////////
CSFML_API sfSelectorTCP* sfSelectorTCP_Create();
CSFML_API sfSelectorUDP* sfSelectorUDP_Create();
CSFML_API sfSocketSelector* sfSocketSelector_Create();
////////////////////////////////////////////////////////////
/// Copy an existing selector
@ -49,8 +48,7 @@ CSFML_API sfSelectorUDP* sfSelectorUDP_Create();
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_API sfSelectorTCP* sfSelectorTCP_Copy(sfSelectorTCP* selector);
CSFML_API sfSelectorUDP* sfSelectorUDP_Copy(sfSelectorUDP* selector);
CSFML_API sfSocketSelector* sfSocketSelector_Copy(sfSocketSelector* selector);
////////////////////////////////////////////////////////////
/// Destroy an existing selector
@ -58,8 +56,7 @@ CSFML_API sfSelectorUDP* sfSelectorUDP_Copy(sfSelectorUDP* selector);
/// \param selector : Selector to delete
///
////////////////////////////////////////////////////////////
CSFML_API void sfSelectorTCP_Destroy(sfSelectorTCP* selector);
CSFML_API void sfSelectorUDP_Destroy(sfSelectorUDP* selector);
CSFML_API void sfSocketSelector_Destroy(sfSocketSelector* selector);
////////////////////////////////////////////////////////////
/// Add a socket to watch to a selector
@ -68,8 +65,9 @@ CSFML_API void sfSelectorUDP_Destroy(sfSelectorUDP* selector);
/// \param socket : Socket to add
///
////////////////////////////////////////////////////////////
CSFML_API void sfSelectorTCP_Add(sfSelectorTCP* selector, sfSocketTCP* socket);
CSFML_API void sfSelectorUDP_Add(sfSelectorUDP* selector, sfSocketUDP* socket);
CSFML_API void sfSocketSelector_AddTcpListener(sfSocketSelector* selector, sfTcpListener* socket);
CSFML_API void sfSocketSelector_AddTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket);
CSFML_API void sfSocketSelector_AddUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket);
////////////////////////////////////////////////////////////
/// Remove a socket from a selector
@ -78,8 +76,9 @@ CSFML_API void sfSelectorUDP_Add(sfSelectorUDP* selector, sfSocketUDP* socket);
/// \param socket : Socket to remove
///
////////////////////////////////////////////////////////////
CSFML_API void sfSelectorTCP_Remove(sfSelectorTCP* selector, sfSocketTCP* socket);
CSFML_API void sfSelectorUDP_Remove(sfSelectorUDP* selector, sfSocketUDP* socket);
CSFML_API void sfSocketSelector_RemoveTcpListener(sfSocketSelector* selector, sfTcpListener* socket);
CSFML_API void sfSocketSelector_RemoveTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket);
CSFML_API void sfSocketSelector_RemoveUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket);
////////////////////////////////////////////////////////////
/// Remove all sockets from a selector
@ -87,36 +86,33 @@ CSFML_API void sfSelectorUDP_Remove(sfSelectorUDP* selector, sfSocketUDP* socket
/// \param selector : Selector to remove the socket from
///
////////////////////////////////////////////////////////////
CSFML_API void sfSelectorTCP_Clear(sfSelectorTCP* selector);
CSFML_API void sfSelectorUDP_Clear(sfSelectorUDP* selector);
CSFML_API void sfSocketSelector_Clear(sfSocketSelector* selector);
////////////////////////////////////////////////////////////
/// Wait and collect sockets which are ready for reading.
/// This functions will return either when at least one socket
/// is ready, or when the given time is out
/// is ready, or when the given timeout is over
///
/// \param selector : Selector to check
/// \param timeout : Maximum time to wait, in seconds (0 to disable timeout)
///
/// \return Number of sockets ready
/// \return sfTrue if there are sockets ready, sfFalse otherwise
///
////////////////////////////////////////////////////////////
CSFML_API unsigned int sfSelectorTCP_Wait(sfSelectorTCP* selector, float timeout);
CSFML_API unsigned int sfSelectorUDP_Wait(sfSelectorUDP* selector, float timeout);
CSFML_API sfBool sfSocketSelector_Wait(sfSocketSelector* selector, float timeout);
////////////////////////////////////////////////////////////
/// After a call to Wait(), get the Index-th socket which is
/// ready for reading. The total number of sockets ready
/// is the integer returned by the previous call to Wait()
/// Test a socket to know if it is ready to receive data
///
/// \param selector : Selector to check
/// \param index : Index of the socket to get
/// \param socket : Socket to test
///
/// \return The Index-th socket
/// \return sfTrue if the socket is ready to receive data
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketTCP* sfSelectorTCP_GetSocketReady(const sfSelectorTCP* selector, unsigned int index);
CSFML_API sfSocketUDP* sfSelectorUDP_GetSocketReady(const sfSelectorUDP* selector, unsigned int index);
CSFML_API sfBool sfSocketSelector_IsTcpListenerReady(const sfSocketSelector* selector, sfTcpListener* socket);
CSFML_API sfBool sfSocketSelector_IsTcpSocketReady(const sfSocketSelector* selector, sfTcpSocket* socket);
CSFML_API sfBool sfSocketSelector_IsUdpSocketReady(const sfSocketSelector* selector, sfUdpSocket* socket);
#endif // SFML_SELECTOR_H
#endif // SFML_SOCKETSELECTOR_H

View file

@ -0,0 +1,97 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////
#ifndef SFML_TCPLISTENER_H
#define SFML_TCPLISTENER_H
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.h>
#include <SFML/Network/SocketStatus.h>
#include <SFML/Network/Types.h>
////////////////////////////////////////////////////////////
/// Construct a new TCP socket
///
/// \return Pointer to the new socket
///
////////////////////////////////////////////////////////////
CSFML_API sfTcpListener* sfTcpListener_Create();
////////////////////////////////////////////////////////////
/// Destroy an existing TCP socket
///
/// \param socket : Socket to destroy
///
////////////////////////////////////////////////////////////
CSFML_API void sfTcpListener_Destroy(sfTcpListener* socket);
////////////////////////////////////////////////////////////
/// Change the blocking state of a TCP socket.
/// The default behaviour of a socket is blocking
///
/// \param socket : Socket to modify
/// \param blocking : Pass sfTrue to set the socket as blocking, or sfFalse for non-blocking
///
////////////////////////////////////////////////////////////
CSFML_API void sfTcpListener_SetBlocking(sfTcpListener* socket, sfBool blocking);
////////////////////////////////////////////////////////////
/// Get the blocking state of the socket
///
/// \param socket : Socket to read
///
/// \Return sfTrue if the socket is blocking, sfFalse otherwise
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfTcpListener_IsBlocking(const sfTcpListener* socket);
////////////////////////////////////////////////////////////
/// Listen to a specified port for incoming data or connections
///
/// \param socket : Socket to use for listening
/// \param port : Port to listen to
///
/// \return Socket status
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketStatus sfTcpListener_Listen(sfTcpListener* socket, unsigned short port);
////////////////////////////////////////////////////////////
/// 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
///
/// \param socket : Socket to use for accepting
/// \param connected : Pointer to a socket pointer that will be filled with the connected client
///
/// \return Socket status
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketStatus sfTcpListener_Accept(sfTcpListener* socket, sfTcpSocket** connected);
#endif // SFML_TCPLISTENER_H

View file

@ -22,8 +22,8 @@
//
////////////////////////////////////////////////////////////
#ifndef SFML_SOCKETTCP_H
#define SFML_SOCKETTCP_H
#ifndef SFML_TCPSOCKET_H
#define SFML_TCPSOCKET_H
////////////////////////////////////////////////////////////
// Headers
@ -40,17 +40,7 @@
/// \return Pointer to the new socket
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketTCP* sfSocketTCP_Create();
////////////////////////////////////////////////////////////
/// Copy an existing TCP socket
///
/// \param socket : Socket to copy
///
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketTCP* sfSocketTCP_Copy(sfSocketTCP* socket);
CSFML_API sfTcpSocket* sfTcpSocket_Create();
////////////////////////////////////////////////////////////
/// Destroy an existing TCP socket
@ -58,7 +48,7 @@ CSFML_API sfSocketTCP* sfSocketTCP_Copy(sfSocketTCP* socket);
/// \param socket : Socket to destroy
///
////////////////////////////////////////////////////////////
CSFML_API void sfSocketTCP_Destroy(sfSocketTCP* socket);
CSFML_API void sfTcpSocket_Destroy(sfTcpSocket* socket);
////////////////////////////////////////////////////////////
/// Change the blocking state of a TCP socket.
@ -68,45 +58,68 @@ CSFML_API void sfSocketTCP_Destroy(sfSocketTCP* socket);
/// \param blocking : Pass sfTrue to set the socket as blocking, or false for non-blocking
///
////////////////////////////////////////////////////////////
CSFML_API void sfSocketTCP_SetBlocking(sfSocketTCP* socket, sfBool blocking);
CSFML_API void sfTcpSocket_SetBlocking(sfTcpSocket* socket, sfBool blocking);
////////////////////////////////////////////////////////////
/// Get the blocking state of the socket
///
/// \param socket : Socket to read
///
/// \Return sfTrue if the socket is blocking, sfFalse otherwise
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfTcpSocket_IsBlocking(const sfTcpSocket* socket);
////////////////////////////////////////////////////////////
/// Get the port to which a socket is bound locally
///
/// \param socket : Socket to read
///
/// \return Port to which the socket is bound
///
////////////////////////////////////////////////////////////
CSFML_API unsigned short sfTcpSocket_GetLocalPort(const sfTcpSocket* socket);
////////////////////////////////////////////////////////////
/// Get the address of the connected peer of a socket
///
/// \param socket : Socket to read
///
/// \return Address of the remote peer
///
////////////////////////////////////////////////////////////
CSFML_API sfIpAddress sfTcpSocket_GetRemoteAddress(const sfTcpSocket* socket);
////////////////////////////////////////////////////////////
/// Get the port of the connected peer to which a socket is connected
///
/// \param socket : Socket to read
///
/// \return Remote port to which the socket is connected
///
////////////////////////////////////////////////////////////
CSFML_API unsigned short sfTcpSocket_GetRemotePort(const sfTcpSocket* socket);
////////////////////////////////////////////////////////////
/// Connect a TCP socket to another computer on a specified port
///
/// \param socket : Socket to use for connecting
/// \param port : Port to use for transfers (warning : ports < 1024 are reserved)
/// \param socket : Socket to connect
/// \param host : IP Address of the host to connect to
/// \param port : Port to use for transfers (warning : ports < 1024 are reserved)
/// \param timeout : Maximum time to wait (0 to use no timeout)
///
/// \return sfTrue if operation has been successful
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketStatus sfSocketTCP_Connect(sfSocketTCP* socket, unsigned short port, sfIpAddress host, float timeout);
CSFML_API sfSocketStatus sfTcpSocket_Connect(sfTcpSocket* socket, sfIpAddress host, unsigned short port, float timeout);
////////////////////////////////////////////////////////////
/// Listen to a specified port for incoming data or connections
/// Disconnect a connect from its remote peer
///
/// \param socket : Socket to use for listening
/// \param port : Port to listen to
///
/// \return sfTrue if operation has been successful
/// \param socket : Socket to disconnect
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfSocketTCP_Listen(sfSocketTCP* socket, unsigned short port);
////////////////////////////////////////////////////////////
/// 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
///
/// \param socket : Socket to use for accepting
/// \param connected : Pointer to a socket pointer that will be filled with the connected client
/// \param address : Pointer to an address to fill with client infos
///
/// \return Socket status
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketStatus sfSocketTCP_Accept(sfSocketTCP* socket, sfSocketTCP** connected, sfIpAddress* address);
CSFML_API void sfTcpSocket_Disconnect(sfTcpSocket* socket);
////////////////////////////////////////////////////////////
/// Send an array of bytes to the host (must be connected first)
@ -118,7 +131,7 @@ CSFML_API sfSocketStatus sfSocketTCP_Accept(sfSocketTCP* socket, sfSocketTCP** c
/// \return Socket status
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketStatus sfSocketTCP_Send(sfSocketTCP* socket, const char* data, size_t size);
CSFML_API sfSocketStatus sfTcpSocket_Send(sfTcpSocket* socket, const char* data, size_t size);
////////////////////////////////////////////////////////////
/// Receive an array of bytes from the host (must be connected first)
@ -131,7 +144,7 @@ CSFML_API sfSocketStatus sfSocketTCP_Send(sfSocketTCP* socket, const char* data,
/// \return Socket status
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketStatus sfSocketTCP_Receive(sfSocketTCP* socket, char* data, size_t maxSize, size_t* sizeReceived);
CSFML_API sfSocketStatus sfTcpSocket_Receive(sfTcpSocket* socket, char* data, size_t maxSize, size_t* sizeReceived);
////////////////////////////////////////////////////////////
/// Send a packet of data to the host (must be connected first)
@ -142,7 +155,7 @@ CSFML_API sfSocketStatus sfSocketTCP_Receive(sfSocketTCP* socket, char* data, si
/// \return Socket status
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketStatus sfSocketTCP_SendPacket(sfSocketTCP* socket, sfPacket* packet);
CSFML_API sfSocketStatus sfTcpSocket_SendPacket(sfTcpSocket* socket, sfPacket* packet);
////////////////////////////////////////////////////////////
/// Receive a packet from the host (must be connected first)
@ -153,28 +166,7 @@ CSFML_API sfSocketStatus sfSocketTCP_SendPacket(sfSocketTCP* socket, sfPacket* p
/// \return Socket status
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketStatus sfSocketTCP_ReceivePacket(sfSocketTCP* socket, sfPacket* packet);
////////////////////////////////////////////////////////////
/// Close the socket
///
/// \param socket : Socket to close
///
/// \return True if the socket was successfully closed
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfSocketTCP_Close(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
///
/// \param socket : Socket to check
///
/// \return True if the socket is valid
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfSocketTCP_IsValid(const sfSocketTCP* socket);
CSFML_API sfSocketStatus sfTcpSocket_ReceivePacket(sfTcpSocket* socket, sfPacket* packet);
#endif // SFML_SOCKETTCP_H
#endif // SFML_TCPSOCKET_H

View file

@ -34,10 +34,10 @@ typedef struct sfHttpRequest sfHttpRequest;
typedef struct sfHttpResponse sfHttpResponse;
typedef struct sfHttp sfHttp;
typedef struct sfPacket sfPacket;
typedef struct sfSelectorTCP sfSelectorTCP;
typedef struct sfSelectorUDP sfSelectorUDP;
typedef struct sfSocketTCP sfSocketTCP;
typedef struct sfSocketUDP sfSocketUDP;
typedef struct sfSocketSelector sfSocketSelector;
typedef struct sfTcpListener sfTcpListener;
typedef struct sfTcpSocket sfTcpSocket;
typedef struct sfUdpSocket sfUdpSocket;
#endif // SFML_NETWORK_TYPES_H

View file

@ -22,8 +22,8 @@
//
////////////////////////////////////////////////////////////
#ifndef SFML_SOCKETUDP_H
#define SFML_SOCKETUDP_H
#ifndef SFML_UDPSOCKET_H
#define SFML_UDPSOCKET_H
////////////////////////////////////////////////////////////
// Headers
@ -40,17 +40,7 @@
/// \return Pointer to the new socket
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketUDP* sfSocketUDP_Create();
////////////////////////////////////////////////////////////
/// Copy an existing UDP socket
///
/// \param socket : Socket to copy
///
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketUDP* sfSocketUDP_Copy(sfSocketUDP* socket);
CSFML_API sfUdpSocket* sfUdpSocket_Create();
////////////////////////////////////////////////////////////
/// Destroy an existing UDP socket
@ -58,7 +48,7 @@ CSFML_API sfSocketUDP* sfSocketUDP_Copy(sfSocketUDP* socket);
/// \param socket : Socket to destroy
///
////////////////////////////////////////////////////////////
CSFML_API void sfSocketUDP_Destroy(sfSocketUDP* socket);
CSFML_API void sfUdpSocket_Destroy(sfUdpSocket* socket);
////////////////////////////////////////////////////////////
/// Change the blocking state of a UDP socket.
@ -68,7 +58,27 @@ CSFML_API void sfSocketUDP_Destroy(sfSocketUDP* socket);
/// \param blocking : Pass sfTrue to set the socket as blocking, or false for non-blocking
///
////////////////////////////////////////////////////////////
CSFML_API void sfSocketUDP_SetBlocking(sfSocketUDP* socket, sfBool blocking);
CSFML_API void sfUdpSocket_SetBlocking(sfUdpSocket* socket, sfBool blocking);
////////////////////////////////////////////////////////////
/// Get the blocking state of the socket
///
/// \param socket : Socket to read
///
/// \Return sfTrue if the socket is blocking, sfFalse otherwise
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfUdpSocket_IsBlocking(const sfUdpSocket* socket);
////////////////////////////////////////////////////////////
/// Get the port to which a socket is bound locally
///
/// \param socket : Socket to read
///
/// \return Port to which the socket is bound
///
////////////////////////////////////////////////////////////
CSFML_API unsigned short sfUdpSocket_GetLocalPort(const sfUdpSocket* socket);
////////////////////////////////////////////////////////////
/// Bind a socket to a specific port
@ -76,20 +86,18 @@ CSFML_API void sfSocketUDP_SetBlocking(sfSocketUDP* socket, sfBool blocking);
/// \param socket : Socket to bind
/// \param port : Port to bind the socket to
///
/// \return True if operation has been successful
/// \return Socket status
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfSocketUDP_Bind(sfSocketUDP* socket, unsigned short port);
CSFML_API sfSocketStatus sfUdpSocket_Bind(sfUdpSocket* socket, unsigned short port);
////////////////////////////////////////////////////////////
/// Unbind a socket from its previous port, if any
///
/// \param socket : Socket to unbind
///
/// \return sfTrue if operation has been successful
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfSocketUDP_Unbind(sfSocketUDP* socket);
CSFML_API void sfUdpSocket_Unbind(sfUdpSocket* socket);
////////////////////////////////////////////////////////////
/// Send an array of bytes
@ -103,7 +111,7 @@ CSFML_API sfBool sfSocketUDP_Unbind(sfSocketUDP* socket);
/// \return Socket status
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketStatus sfSocketUDP_Send(sfSocketUDP* socket, const char* data, size_t size, sfIpAddress address, unsigned short port);
CSFML_API sfSocketStatus sfUdpSocket_Send(sfUdpSocket* socket, const char* data, size_t size, sfIpAddress address, unsigned short port);
////////////////////////////////////////////////////////////
/// Receive an array of bytes.
@ -120,7 +128,7 @@ CSFML_API sfSocketStatus sfSocketUDP_Send(sfSocketUDP* socket, const char* data,
/// \return Socket status
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketStatus sfSocketUDP_Receive(sfSocketUDP* socket, char* data, size_t maxSize, size_t* sizeReceived, sfIpAddress* address, unsigned short* port);
CSFML_API sfSocketStatus sfUdpSocket_Receive(sfUdpSocket* socket, char* data, size_t maxSize, size_t* sizeReceived, sfIpAddress* address, unsigned short* port);
////////////////////////////////////////////////////////////
/// Send a packet of data
@ -133,7 +141,7 @@ CSFML_API sfSocketStatus sfSocketUDP_Receive(sfSocketUDP* socket, char* data, si
/// \return Socket status
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketStatus sfSocketUDP_SendPacket(sfSocketUDP* socket, sfPacket* packet, sfIpAddress address, unsigned short port);
CSFML_API sfSocketStatus sfUdpSocket_SendPacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress address, unsigned short port);
////////////////////////////////////////////////////////////
/// Receive a packet.
@ -148,28 +156,7 @@ CSFML_API sfSocketStatus sfSocketUDP_SendPacket(sfSocketUDP* socket, sfPacket* p
/// \return Socket status
///
////////////////////////////////////////////////////////////
CSFML_API sfSocketStatus sfSocketUDP_ReceivePacket(sfSocketUDP* socket, sfPacket* packet, sfIpAddress* address, unsigned short* port);
////////////////////////////////////////////////////////////
/// Close the socket
///
/// \param socket : Socket to close
///
/// \return True if the socket was successfully closed
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfSocketUDP_Close(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
///
/// \param socket : Socket to check
///
/// \return sfTrue if the socket is valid
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfSocketUDP_IsValid(sfSocketUDP* socket);
CSFML_API sfSocketStatus sfUdpSocket_ReceivePacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress* address, unsigned short* port);
#endif // SFML_SOCKETUDP_H
#endif // SFML_UDPSOCKET_H