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:
parent
a09ee0f9e3
commit
9280771665
66 changed files with 3976 additions and 2992 deletions
|
@ -243,49 +243,57 @@
|
|||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Network\Selector.cpp"
|
||||
RelativePath="..\..\src\SFML\Network\SocketSelector.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\SFML\Network\Selector.h"
|
||||
RelativePath="..\..\include\SFML\Network\SocketSelector.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Network\SelectorStruct.h"
|
||||
RelativePath="..\..\src\SFML\Network\SocketSelectorStruct.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\SFML\Network\SocketStatus.h"
|
||||
RelativePath="..\..\src\SFML\Network\TcpListener.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Network\SocketTCP.cpp"
|
||||
RelativePath="..\..\include\SFML\Network\TcpListener.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\SFML\Network\SocketTCP.h"
|
||||
RelativePath="..\..\src\SFML\Network\TcpListenerStruct.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Network\SocketTCPStruct.h"
|
||||
RelativePath="..\..\src\SFML\Network\TcpSocket.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Network\SocketUDP.cpp"
|
||||
RelativePath="..\..\include\SFML\Network\TcpSocket.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\SFML\Network\SocketUDP.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Network\SocketUDPStruct.h"
|
||||
RelativePath="..\..\src\SFML\Network\TcpSocketStruct.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\SFML\Network\Types.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Network\UdpSocket.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\SFML\Network\UdpSocket.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Network\UdpSocketStruct.h"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
|
|
@ -242,15 +242,15 @@
|
|||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Network\Selector.cpp"
|
||||
RelativePath="..\..\src\SFML\Network\SocketSelector.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\SFML\Network\Selector.h"
|
||||
RelativePath="..\..\include\SFML\Network\SocketSelector.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Network\SelectorStruct.h"
|
||||
RelativePath="..\..\src\SFML\Network\SocketSelectorStruct.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
@ -258,33 +258,45 @@
|
|||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Network\SocketTCP.cpp"
|
||||
RelativePath="..\..\src\SFML\Network\TcpListener.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\SFML\Network\SocketTCP.h"
|
||||
RelativePath="..\..\include\SFML\Network\TcpListener.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Network\SocketTCPStruct.h"
|
||||
RelativePath="..\..\src\SFML\Network\TcpListenerStruct.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Network\SocketUDP.cpp"
|
||||
RelativePath="..\..\src\SFML\Network\TcpSocket.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\SFML\Network\SocketUDP.h"
|
||||
RelativePath="..\..\include\SFML\Network\TcpSocket.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Network\SocketUDPStruct.h"
|
||||
RelativePath="..\..\src\SFML\Network\TcpSocketStruct.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\SFML\Network\Types.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Network\UdpSocket.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\SFML\Network\UdpSocket.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\SFML\Network\UdpSocketStruct.h"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_workspace_file>
|
||||
<Workspace title="CSFML workspace">
|
||||
<Project filename="csfml-main.cbp" active="1" />
|
||||
<Project filename="csfml-main.cbp" />
|
||||
<Project filename="csfml-system.cbp" />
|
||||
<Project filename="csfml-window.cbp" />
|
||||
<Project filename="csfml-graphics.cbp" />
|
||||
<Project filename="csfml-audio.cbp" />
|
||||
<Project filename="csfml-network.cbp" />
|
||||
<Project filename="csfml-network.cbp" active="1" />
|
||||
</Workspace>
|
||||
</CodeBlocks_workspace_file>
|
||||
|
|
|
@ -58,11 +58,14 @@
|
|||
<Unit filename="..\..\include\SFML\Network\Http.h" />
|
||||
<Unit filename="..\..\include\SFML\Network\IpAddress.h" />
|
||||
<Unit filename="..\..\include\SFML\Network\Packet.h" />
|
||||
<Unit filename="..\..\include\SFML\Network\Selector.h" />
|
||||
<Unit filename="..\..\include\SFML\Network\SocketSelector.h" />
|
||||
<Unit filename="..\..\include\SFML\Network\SocketStatus.h" />
|
||||
<Unit filename="..\..\include\SFML\Network\SocketTCP.h" />
|
||||
<Unit filename="..\..\include\SFML\Network\SocketUDP.h" />
|
||||
<Unit filename="..\..\include\SFML\Network\TcpListener.h" />
|
||||
<Unit filename="..\..\include\SFML\Network\TcpSocket.h" />
|
||||
<Unit filename="..\..\include\SFML\Network\Types.h" />
|
||||
<Unit filename="..\..\include\SFML\Network\UdpSocket.h" />
|
||||
<Unit filename="..\..\src\SFML\Network\Ftp.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Network\FtpStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Network\Http.cpp" />
|
||||
|
@ -70,12 +73,14 @@
|
|||
<Unit filename="..\..\src\SFML\Network\IpAddress.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Network\Packet.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Network\PacketStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Network\Selector.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Network\SelectorStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Network\SocketTCP.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Network\SocketTCPStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Network\SocketUDP.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Network\SocketUDPStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Network\SocketSelector.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Network\SocketSelectorStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Network\TcpListener.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Network\TcpListenerStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Network\TcpSocket.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Network\TcpSocketStruct.h" />
|
||||
<Unit filename="..\..\src\SFML\Network\UdpSocket.cpp" />
|
||||
<Unit filename="..\..\src\SFML\Network\UdpSocketStruct.h" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
97
CSFML/include/SFML/Network/TcpListener.h
Normal file
97
CSFML/include/SFML/Network/TcpListener.h
Normal 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
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -39,6 +39,7 @@ void sfFtpListingResponse_Destroy(sfFtpListingResponse* ftpListingResponse)
|
|||
delete ftpListingResponse;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Convenience function to check if the response status code
|
||||
/// means a success
|
||||
|
@ -48,6 +49,7 @@ sfBool sfFtpListingResponse_IsOk(const sfFtpListingResponse* ftpListingResponse)
|
|||
CSFML_CALL_RETURN(ftpListingResponse, IsOk(), sfFalse);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the response status code
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -58,6 +60,7 @@ sfFtpStatus sfFtpListingResponse_GetStatus(const sfFtpListingResponse* ftpListin
|
|||
return static_cast<sfFtpStatus>(ftpListingResponse->This.GetStatus());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the full message contained in the response
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -68,14 +71,18 @@ const char* sfFtpListingResponse_GetMessage(const sfFtpListingResponse* ftpListi
|
|||
return ftpListingResponse->This.GetMessage().c_str();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the number of filenames in the listing
|
||||
////////////////////////////////////////////////////////////
|
||||
size_t sfFtpListingResponse_GetCount(const sfFtpListingResponse* ftpListingResponse)
|
||||
{
|
||||
CSFML_CALL_RETURN(ftpListingResponse, GetCount(), 0);
|
||||
CSFML_CHECK_RETURN(ftpListingResponse, 0);
|
||||
|
||||
return ftpListingResponse->This.GetFilenames().size();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Index-th filename in the directory
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -83,7 +90,7 @@ const char* sfFtpListingResponse_GetFilename(const sfFtpListingResponse* ftpList
|
|||
{
|
||||
CSFML_CHECK_RETURN(ftpListingResponse, NULL);
|
||||
|
||||
return ftpListingResponse->This.GetFilename(index).c_str();
|
||||
return ftpListingResponse->This.GetFilenames()[index].c_str();
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,6 +102,7 @@ void sfFtpDirectoryResponse_Destroy(sfFtpDirectoryResponse* ftpDirectoryResponse
|
|||
delete ftpDirectoryResponse;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Convenience function to check if the response status code
|
||||
/// means a success
|
||||
|
@ -104,6 +112,7 @@ sfBool sfFtpDirectoryResponse_IsOk(const sfFtpDirectoryResponse* ftpDirectoryRes
|
|||
CSFML_CALL_RETURN(ftpDirectoryResponse, IsOk(), sfFalse);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the response status code
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -114,6 +123,7 @@ sfFtpStatus sfFtpDirectoryResponse_GetStatus(const sfFtpDirectoryResponse* ftpDi
|
|||
return static_cast<sfFtpStatus>(ftpDirectoryResponse->This.GetStatus());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the full message contained in the response
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -124,6 +134,7 @@ const char* sfFtpDirectoryResponse_GetMessage(const sfFtpDirectoryResponse* ftpD
|
|||
return ftpDirectoryResponse->This.GetMessage().c_str();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the directory returned in the response
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -299,11 +310,11 @@ sfFtpResponse* sfFtp_ParentDirectory(sfFtp* ftp)
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Create a new directory
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpResponse* sfFtp_MakeDirectory(sfFtp* ftp, const char* name)
|
||||
sfFtpResponse* sfFtp_CreateDirectory(sfFtp* ftp, const char* name)
|
||||
{
|
||||
CSFML_CHECK_RETURN(ftp, NULL);
|
||||
|
||||
return new sfFtpResponse(ftp->This.MakeDirectory(name ? name : ""));
|
||||
return new sfFtpResponse(ftp->This.CreateDirectory(name ? name : ""));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Ftp.hpp>
|
||||
#include <vector>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -78,7 +79,14 @@ struct sfFtpListingResponse
|
|||
{
|
||||
}
|
||||
|
||||
~sfFtpListingResponse()
|
||||
{
|
||||
for (std::vector<const char*>::iterator it = Filenames.begin(); it != Filenames.end(); ++it)
|
||||
delete[] *it;
|
||||
}
|
||||
|
||||
sf::Ftp::ListingResponse This;
|
||||
std::vector<const char*> Filenames;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -73,9 +73,9 @@ void sfHttpRequest_SetMethod(sfHttpRequest* httpRequest, sfHttpMethod method)
|
|||
/// Set the target URI of the request.
|
||||
/// This parameter is "/" by default
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfHttpRequest_SetURI(sfHttpRequest* httpRequest, const char* URI)
|
||||
void sfHttpRequest_SetUri(sfHttpRequest* httpRequest, const char* uri)
|
||||
{
|
||||
CSFML_CALL(httpRequest, SetURI(URI ? URI : ""));
|
||||
CSFML_CALL(httpRequest, SetUri(uri ? uri : ""));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,73 +25,118 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Selector.h>
|
||||
#include <SFML/Network/SelectorStruct.h>
|
||||
#include <SFML/Network/SocketSelector.h>
|
||||
#include <SFML/Network/SocketSelectorStruct.h>
|
||||
#include <SFML/Network/TcpListenerStruct.h>
|
||||
#include <SFML/Network/TcpSocketStruct.h>
|
||||
#include <SFML/Network/UdpSocketStruct.h>
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new selector
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSelectorTCP* sfSelectorTCP_Create() {return new sfSelectorTCP;}
|
||||
sfSelectorUDP* sfSelectorUDP_Create() {return new sfSelectorUDP;}
|
||||
sfSocketSelector* sfSocketSelector_Create()
|
||||
{
|
||||
return new sfSocketSelector;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing selector
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSelectorTCP* sfSelectorTCP_Copy(sfSelectorTCP* selector) {CSFML_CHECK_RETURN(selector, NULL); return new sfSelectorTCP(*selector);}
|
||||
sfSelectorUDP* sfSelectorUDP_Copy(sfSelectorUDP* selector) {CSFML_CHECK_RETURN(selector, NULL); return new sfSelectorUDP(*selector);}
|
||||
sfSocketSelector* sfSocketSelector_Copy(sfSocketSelector* selector)
|
||||
{
|
||||
CSFML_CHECK_RETURN(selector, NULL);
|
||||
|
||||
return new sfSocketSelector(*selector);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing selector
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSelectorTCP_Destroy(sfSelectorTCP* selector) {delete selector;}
|
||||
void sfSelectorUDP_Destroy(sfSelectorUDP* selector) {delete selector;}
|
||||
void sfSocketSelector_Destroy(sfSocketSelector* selector)
|
||||
{
|
||||
delete selector;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Add a socket to watch to a selector
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSelectorTCP_Add(sfSelectorTCP* selector, sfSocketTCP* socket) {CSFML_CALL(selector, Add(socket->This)); selector->Sockets[socket->This] = socket;}
|
||||
void sfSelectorUDP_Add(sfSelectorUDP* selector, sfSocketUDP* socket) {CSFML_CALL(selector, Add(socket->This)); selector->Sockets[socket->This] = socket;}
|
||||
void sfSocketSelector_AddTcpListener(sfSocketSelector* selector, sfTcpListener* socket)
|
||||
{
|
||||
CSFML_CHECK(socket);
|
||||
CSFML_CALL(selector, Add(socket->This));
|
||||
}
|
||||
void sfSocketSelector_AddTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket)
|
||||
{
|
||||
CSFML_CHECK(socket);
|
||||
CSFML_CALL(selector, Add(socket->This));
|
||||
}
|
||||
void sfSocketSelector_AddUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket)
|
||||
{
|
||||
CSFML_CHECK(socket);
|
||||
CSFML_CALL(selector, Add(socket->This));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Remove a socket from a selector
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSelectorTCP_Remove(sfSelectorTCP* selector, sfSocketTCP* socket) {CSFML_CALL(selector, Remove(socket->This)); selector->Sockets.erase(socket->This);}
|
||||
void sfSelectorUDP_Remove(sfSelectorUDP* selector, sfSocketUDP* socket) {CSFML_CALL(selector, Remove(socket->This)); selector->Sockets.erase(socket->This);}
|
||||
void sfSocketSelector_RemoveTcpListener(sfSocketSelector* selector, sfTcpListener* socket)
|
||||
{
|
||||
CSFML_CHECK(socket);
|
||||
CSFML_CALL(selector, Remove(socket->This));
|
||||
}
|
||||
void sfSocketSelector_RemoveTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket)
|
||||
{
|
||||
CSFML_CHECK(socket);
|
||||
CSFML_CALL(selector, Remove(socket->This));
|
||||
}
|
||||
void sfSocketSelector_RemoveUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket)
|
||||
{
|
||||
CSFML_CHECK(socket);
|
||||
CSFML_CALL(selector, Remove(socket->This));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Remove all sockets from a selector
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSelectorTCP_Clear(sfSelectorTCP* selector) {CSFML_CALL(selector, Clear()); selector->Sockets.clear();}
|
||||
void sfSelectorUDP_Clear(sfSelectorUDP* selector) {CSFML_CALL(selector, Clear()); selector->Sockets.clear();}
|
||||
void sfSocketSelector_Clear(sfSocketSelector* selector)
|
||||
{
|
||||
CSFML_CALL(selector, Clear());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfSelectorTCP_Wait(sfSelectorTCP* selector, float timeout) {CSFML_CALL_RETURN(selector, Wait(timeout), 0);}
|
||||
unsigned int sfSelectorUDP_Wait(sfSelectorUDP* selector, float timeout) {CSFML_CALL_RETURN(selector, Wait(timeout), 0);}
|
||||
sfBool sfSocketSelector_Wait(sfSocketSelector* selector, float timeout)
|
||||
{
|
||||
CSFML_CALL_RETURN(selector, Wait(timeout), sfFalse);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketTCP* sfSelectorTCP_GetSocketReady(const sfSelectorTCP* selector, unsigned int index)
|
||||
sfBool sfSocketSelector_IsTcpListenerReady(const sfSocketSelector* selector, sfTcpListener* socket)
|
||||
{
|
||||
CSFML_CHECK_RETURN(selector, NULL);
|
||||
return selector->Sockets.find(selector->This.GetSocketReady(index))->second;
|
||||
CSFML_CHECK_RETURN(socket, sfFalse);
|
||||
CSFML_CALL_RETURN(selector, IsReady(socket->This), sfFalse);
|
||||
}
|
||||
sfSocketUDP* sfSelectorUDP_GetSocketReady(const sfSelectorUDP* selector, unsigned int index)
|
||||
sfBool sfSocketSelector_IsTcpSocketReady(const sfSocketSelector* selector, sfTcpSocket* socket)
|
||||
{
|
||||
CSFML_CHECK_RETURN(selector, NULL);
|
||||
return selector->Sockets.find(selector->This.GetSocketReady(index))->second;
|
||||
CSFML_CHECK_RETURN(socket, sfFalse);
|
||||
CSFML_CALL_RETURN(selector, IsReady(socket->This), sfFalse);
|
||||
}
|
||||
sfBool sfSocketSelector_IsUdpSocketReady(const sfSocketSelector* selector, sfUdpSocket* socket)
|
||||
{
|
||||
CSFML_CHECK_RETURN(socket, sfFalse);
|
||||
CSFML_CALL_RETURN(selector, IsReady(socket->This), sfFalse);
|
||||
}
|
|
@ -22,36 +22,22 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SELECTORSTRUCT_H
|
||||
#define SFML_SELECTORSTRUCT_H
|
||||
#ifndef SFML_SOCKETSELECTORSTRUCT_H
|
||||
#define SFML_SOCKETSELECTORSTRUCT_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/Selector.hpp>
|
||||
#include <SFML/Network/SocketTCPStruct.h>
|
||||
#include <SFML/Network/SocketUDPStruct.h>
|
||||
#include <map>
|
||||
#include <SFML/Network/SocketSelector.hpp>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Internal structure of SelectorTCP
|
||||
// Internal structure of sfSocketSelector
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfSelectorTCP
|
||||
struct sfSocketSelector
|
||||
{
|
||||
sf::SelectorTCP This;
|
||||
std::map<sf::SocketTCP, sfSocketTCP*> Sockets;
|
||||
sf::SocketSelector This;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Internal structure of sfSelectorUDP
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfSelectorUDP
|
||||
{
|
||||
sf::SelectorUDP This;
|
||||
std::map<sf::SocketUDP, sfSocketUDP*> Sockets;
|
||||
};
|
||||
|
||||
|
||||
#endif // SFML_SELECTORSTRUCT_H
|
||||
#endif // SFML_SOCKETSELECTORSTRUCT_H
|
94
CSFML/src/SFML/Network/TcpListener.cpp
Normal file
94
CSFML/src/SFML/Network/TcpListener.cpp
Normal file
|
@ -0,0 +1,94 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/TcpListener.h>
|
||||
#include <SFML/Network/TcpListenerStruct.h>
|
||||
#include <SFML/Network/TcpSocketStruct.h>
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new TCP socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfTcpListener* sfTcpListener_Create()
|
||||
{
|
||||
return new sfTcpListener;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing TCP socket
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfTcpListener_Destroy(sfTcpListener* socket)
|
||||
{
|
||||
delete socket;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the blocking state of a TCP socket.
|
||||
/// The default behaviour of a socket is blocking
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfTcpListener_SetBlocking(sfTcpListener* socket, sfBool blocking)
|
||||
{
|
||||
CSFML_CALL(socket, SetBlocking(blocking == sfTrue));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the blocking state of the socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfTcpListener_IsBlocking(const sfTcpListener* socket)
|
||||
{
|
||||
CSFML_CALL_RETURN(socket, IsBlocking(), sfFalse);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Listen to a specified port for incoming data or connections
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfTcpListener_Listen(sfTcpListener* socket, unsigned short port)
|
||||
{
|
||||
CSFML_CHECK_RETURN(socket, sfSocketError);
|
||||
|
||||
return static_cast<sfSocketStatus>(socket->This.Listen(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
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfTcpListener_Accept(sfTcpListener* socket, sfTcpSocket** connected)
|
||||
{
|
||||
CSFML_CHECK_RETURN(socket, sfSocketError);
|
||||
CSFML_CHECK_RETURN(connected, sfSocketError);
|
||||
|
||||
*connected = new sfTcpSocket;
|
||||
return static_cast<sfSocketStatus>(socket->This.Accept((*connected)->This));
|
||||
}
|
43
CSFML/src/SFML/Network/TcpListenerStruct.h
Normal file
43
CSFML/src/SFML/Network/TcpListenerStruct.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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_TCPLISTENERSTRUCT_H
|
||||
#define SFML_TCPLISTENERSTRUCT_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/TcpListener.hpp>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Internal structure of sfTcpListener
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfTcpListener
|
||||
{
|
||||
sf::TcpListener This;
|
||||
};
|
||||
|
||||
|
||||
#endif // SFML_TCPLISTENERSTRUCT_H
|
|
@ -25,8 +25,8 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/SocketTCP.h>
|
||||
#include <SFML/Network/SocketTCPStruct.h>
|
||||
#include <SFML/Network/TcpSocket.h>
|
||||
#include <SFML/Network/TcpSocketStruct.h>
|
||||
#include <SFML/Network/PacketStruct.h>
|
||||
#include <SFML/Network/IpAddress.hpp>
|
||||
#include <SFML/Internal.h>
|
||||
|
@ -36,33 +36,18 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new TCP socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketTCP* sfSocketTCP_Create()
|
||||
sfTcpSocket* sfTcpSocket_Create()
|
||||
{
|
||||
return new sfSocketTCP;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing TCP socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketTCP* sfSocketTCP_Copy(sfSocketTCP* socket)
|
||||
{
|
||||
CSFML_CHECK_RETURN(socket, NULL);
|
||||
|
||||
return new sfSocketTCP(*socket);
|
||||
return new sfTcpSocket;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing TCP socket
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSocketTCP_Destroy(sfSocketTCP* socket)
|
||||
void sfTcpSocket_Destroy(sfTcpSocket* socket)
|
||||
{
|
||||
if (socket)
|
||||
{
|
||||
socket->This.Close();
|
||||
delete socket;
|
||||
}
|
||||
delete socket;
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,67 +55,80 @@ void sfSocketTCP_Destroy(sfSocketTCP* socket)
|
|||
/// Change the blocking state of a TCP socket.
|
||||
/// The default behaviour of a socket is blocking
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSocketTCP_SetBlocking(sfSocketTCP* socket, sfBool blocking)
|
||||
void sfTcpSocket_SetBlocking(sfTcpSocket* socket, sfBool blocking)
|
||||
{
|
||||
CSFML_CALL(socket, SetBlocking(blocking == sfTrue));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the blocking state of the socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfTcpSocket_IsBlocking(const sfTcpSocket* socket)
|
||||
{
|
||||
CSFML_CALL_RETURN(socket, IsBlocking(), sfFalse);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the port to which a socket is bound locally
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned short sfTcpSocket_GetLocalPort(const sfTcpSocket* socket)
|
||||
{
|
||||
CSFML_CALL_RETURN(socket, GetLocalPort(), 0);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the address of the connected peer of a socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfIpAddress sfTcpSocket_GetRemoteAddress(const sfTcpSocket* socket)
|
||||
{
|
||||
sfIpAddress result;
|
||||
CSFML_CHECK_RETURN(socket, result);
|
||||
|
||||
sf::IpAddress address = socket->This.GetRemoteAddress();
|
||||
strncpy(result.Address, address.ToString().c_str(), 16);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the port of the connected peer to which a socket is connected
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned short sfTcpSocket_GetRemotePort(const sfTcpSocket* socket)
|
||||
{
|
||||
CSFML_CALL_RETURN(socket, GetRemotePort(), 0);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Connect a TCP socket to another computer on a specified port
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfSocketTCP_Connect(sfSocketTCP* socket, unsigned short port, sfIpAddress host, float timeout)
|
||||
sfSocketStatus sfTcpSocket_Connect(sfTcpSocket* socket, sfIpAddress host, unsigned short port, float timeout)
|
||||
{
|
||||
sf::IpAddress address(host.Address);
|
||||
|
||||
CSFML_CHECK_RETURN(socket, sfSocketError);
|
||||
|
||||
return static_cast<sfSocketStatus>(socket->This.Connect(port, address, timeout));
|
||||
return static_cast<sfSocketStatus>(socket->This.Connect(address, port, timeout));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Listen to a specified port for incoming data or connections
|
||||
/// Disconnect a connect from its remote peer
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfSocketTCP_Listen(sfSocketTCP* socket, unsigned short port)
|
||||
void sfTcpSocket_Disconnect(sfTcpSocket* socket)
|
||||
{
|
||||
CSFML_CALL_RETURN(socket, Listen(port), sfFalse);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfSocketTCP_Accept(sfSocketTCP* socket, sfSocketTCP** connected, sfIpAddress* address)
|
||||
{
|
||||
CSFML_CHECK_RETURN(socket, sfSocketError);
|
||||
CSFML_CHECK_RETURN(connected, sfSocketError);
|
||||
|
||||
// Call SFML internal function
|
||||
sf::IpAddress clientAddress;
|
||||
sf::SocketTCP client;
|
||||
sf::Socket::Status status = socket->This.Accept(client, &clientAddress);
|
||||
if (status != sf::Socket::Done)
|
||||
return static_cast<sfSocketStatus>(status);
|
||||
|
||||
// Convert the client socket returned
|
||||
*connected = sfSocketTCP_Create();
|
||||
(*connected)->This = client;
|
||||
|
||||
// Convert the address if needed
|
||||
if (address)
|
||||
strncpy(address->Address, clientAddress.ToString().c_str(), 16);
|
||||
|
||||
return sfSocketDone;
|
||||
CSFML_CALL(socket, Disconnect());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send an array of bytes to the host (must be connected first)
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfSocketTCP_Send(sfSocketTCP* socket, const char* data, size_t size)
|
||||
sfSocketStatus sfTcpSocket_Send(sfTcpSocket* socket, const char* data, size_t size)
|
||||
{
|
||||
CSFML_CHECK_RETURN(socket, sfSocketError);
|
||||
|
||||
|
@ -141,7 +139,7 @@ sfSocketStatus sfSocketTCP_Send(sfSocketTCP* socket, const char* data, size_t si
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Receive an array of bytes from the host (must be connected first)
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfSocketTCP_Receive(sfSocketTCP* socket, char* data, size_t maxSize, size_t* sizeReceived)
|
||||
sfSocketStatus sfTcpSocket_Receive(sfTcpSocket* socket, char* data, size_t maxSize, size_t* sizeReceived)
|
||||
{
|
||||
CSFML_CHECK_RETURN(socket, sfSocketError);
|
||||
|
||||
|
@ -160,7 +158,7 @@ sfSocketStatus sfSocketTCP_Receive(sfSocketTCP* socket, char* data, size_t maxSi
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Send a packet of data to the host (must be connected first)
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfSocketTCP_SendPacket(sfSocketTCP* socket, sfPacket* packet)
|
||||
sfSocketStatus sfTcpSocket_SendPacket(sfTcpSocket* socket, sfPacket* packet)
|
||||
{
|
||||
CSFML_CHECK_RETURN(socket, sfSocketError);
|
||||
CSFML_CHECK_RETURN(packet, sfSocketError);
|
||||
|
@ -172,29 +170,10 @@ sfSocketStatus sfSocketTCP_SendPacket(sfSocketTCP* socket, sfPacket* packet)
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Receive a packet from the host (must be connected first)
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfSocketTCP_ReceivePacket(sfSocketTCP* socket, sfPacket* packet)
|
||||
sfSocketStatus sfTcpSocket_ReceivePacket(sfTcpSocket* socket, sfPacket* packet)
|
||||
{
|
||||
CSFML_CHECK_RETURN(socket, sfSocketError);
|
||||
CSFML_CHECK_RETURN(packet, sfSocketError);
|
||||
|
||||
return static_cast<sfSocketStatus>(socket->This.Receive(packet->This));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Close the socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfSocketTCP_Close(sfSocketTCP* socket)
|
||||
{
|
||||
CSFML_CALL_RETURN(socket, Close(), sfFalse);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Check if a socket is in a valid state ; this function
|
||||
/// can be called any time to check if the socket is OK
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfSocketTCP_IsValid(const sfSocketTCP* socket)
|
||||
{
|
||||
CSFML_CALL_RETURN(socket, IsValid(), sfFalse);
|
||||
}
|
|
@ -22,22 +22,22 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOCKETTCPSTRUCT_H
|
||||
#define SFML_SOCKETTCPSTRUCT_H
|
||||
#ifndef SFML_TCPSOCKETSTRUCT_H
|
||||
#define SFML_TCPSOCKETSTRUCT_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/SocketTCP.hpp>
|
||||
#include <SFML/Network/TcpSocket.hpp>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Internal structure of sfSocketTCP
|
||||
// Internal structure of sfTcpSocket
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfSocketTCP
|
||||
struct sfTcpSocket
|
||||
{
|
||||
sf::SocketTCP This;
|
||||
sf::TcpSocket This;
|
||||
};
|
||||
|
||||
|
||||
#endif // SFML_SOCKETTCPSTRUCT_H
|
||||
#endif // SFML_TCPSOCKETSTRUCT_H
|
|
@ -25,8 +25,8 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/SocketUDP.h>
|
||||
#include <SFML/Network/SocketUDPStruct.h>
|
||||
#include <SFML/Network/UdpSocket.h>
|
||||
#include <SFML/Network/UdpSocketStruct.h>
|
||||
#include <SFML/Network/PacketStruct.h>
|
||||
#include <SFML/Network/IpAddress.hpp>
|
||||
#include <SFML/Internal.h>
|
||||
|
@ -36,33 +36,18 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new UDP socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketUDP* sfSocketUDP_Create()
|
||||
sfUdpSocket* sfUdpSocket_Create()
|
||||
{
|
||||
return new sfSocketUDP;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing UDP socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketUDP* sfSocketUDP_Copy(sfSocketUDP* socket)
|
||||
{
|
||||
CSFML_CHECK_RETURN(socket, NULL);
|
||||
|
||||
return new sfSocketUDP(*socket);
|
||||
return new sfUdpSocket;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing UDP socket
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSocketUDP_Destroy(sfSocketUDP* socket)
|
||||
void sfUdpSocket_Destroy(sfUdpSocket* socket)
|
||||
{
|
||||
if (socket)
|
||||
{
|
||||
socket->This.Close();
|
||||
delete socket;
|
||||
}
|
||||
delete socket;
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,34 +55,53 @@ void sfSocketUDP_Destroy(sfSocketUDP* socket)
|
|||
/// Change the blocking state of a UDP socket.
|
||||
/// The default behaviour of a socket is blocking
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSocketUDP_SetBlocking(sfSocketUDP* socket, sfBool blocking)
|
||||
void sfUdpSocket_SetBlocking(sfUdpSocket* socket, sfBool blocking)
|
||||
{
|
||||
CSFML_CALL(socket, SetBlocking(blocking == sfTrue));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the blocking state of the socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfUdpSocket_IsBlocking(const sfUdpSocket* socket)
|
||||
{
|
||||
CSFML_CALL_RETURN(socket, IsBlocking(), sfFalse);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the port to which the socket is bound locally
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned short sfUdpSocket_GetLocalPort(const sfUdpSocket* socket)
|
||||
{
|
||||
CSFML_CALL_RETURN(socket, GetLocalPort(), 0);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Bind a socket to a specific port
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfSocketUDP_Bind(sfSocketUDP* socket, unsigned short port)
|
||||
sfSocketStatus sfUdpSocket_Bind(sfUdpSocket* socket, unsigned short port)
|
||||
{
|
||||
CSFML_CALL_RETURN(socket, Bind(port), sfFalse);
|
||||
CSFML_CHECK_RETURN(socket, sfSocketError);
|
||||
|
||||
return static_cast<sfSocketStatus>(socket->This.Bind(port));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Unbind a socket from its previous port, if any
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfSocketUDP_Unbind(sfSocketUDP* socket)
|
||||
void sfUdpSocket_Unbind(sfUdpSocket* socket)
|
||||
{
|
||||
CSFML_CALL_RETURN(socket, Unbind(), sfFalse);
|
||||
CSFML_CALL(socket, Unbind());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send an array of bytes
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfSocketUDP_Send(sfSocketUDP* socket, const char* data, size_t size, sfIpAddress address, unsigned short port)
|
||||
sfSocketStatus sfUdpSocket_Send(sfUdpSocket* socket, const char* data, size_t size, sfIpAddress address, unsigned short port)
|
||||
{
|
||||
CSFML_CHECK_RETURN(socket, sfSocketError)
|
||||
|
||||
|
@ -113,7 +117,7 @@ sfSocketStatus sfSocketUDP_Send(sfSocketUDP* socket, const char* data, size_t si
|
|||
/// This function is blocking, ie. it won't return before some
|
||||
/// bytes have been received
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfSocketUDP_Receive(sfSocketUDP* socket, char* data, size_t maxSize, size_t* sizeReceived, sfIpAddress* address, unsigned short* port)
|
||||
sfSocketStatus sfUdpSocket_Receive(sfUdpSocket* socket, char* data, size_t maxSize, size_t* sizeReceived, sfIpAddress* address, unsigned short* port)
|
||||
{
|
||||
CSFML_CHECK_RETURN(socket, sfSocketError);
|
||||
|
||||
|
@ -142,7 +146,7 @@ sfSocketStatus sfSocketUDP_Receive(sfSocketUDP* socket, char* data, size_t maxSi
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Send a packet of data
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfSocketUDP_SendPacket(sfSocketUDP* socket, sfPacket* packet, sfIpAddress address, unsigned short port)
|
||||
sfSocketStatus sfUdpSocket_SendPacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress address, unsigned short port)
|
||||
{
|
||||
CSFML_CHECK_RETURN(socket, sfSocketError);
|
||||
CSFML_CHECK_RETURN(packet, sfSocketError);
|
||||
|
@ -159,7 +163,7 @@ sfSocketStatus sfSocketUDP_SendPacket(sfSocketUDP* socket, sfPacket* packet, sfI
|
|||
/// This function is blocking, ie. it won't return before a
|
||||
/// packet is received
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfSocketUDP_ReceivePacket(sfSocketUDP* socket, sfPacket* packet, sfIpAddress* address, unsigned short* port)
|
||||
sfSocketStatus sfUdpSocket_ReceivePacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress* address, unsigned short* port)
|
||||
{
|
||||
CSFML_CHECK_RETURN(socket, sfSocketError);
|
||||
CSFML_CHECK_RETURN(packet, sfSocketError);
|
||||
|
@ -178,22 +182,3 @@ sfSocketStatus sfSocketUDP_ReceivePacket(sfSocketUDP* socket, sfPacket* packet,
|
|||
|
||||
return sfSocketDone;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Close the socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfSocketUDP_Close(sfSocketUDP* socket)
|
||||
{
|
||||
CSFML_CALL_RETURN(socket, Close(), sfFalse);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Check if a socket is in a valid state ; this function
|
||||
/// can be called any time to check if the socket is OK
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfSocketUDP_IsValid(const sfSocketUDP* socket)
|
||||
{
|
||||
CSFML_CALL_RETURN(socket, IsValid(), sfFalse);
|
||||
}
|
|
@ -22,22 +22,22 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOCKETUDPSTRUCT_H
|
||||
#define SFML_SOCKETUDPSTRUCT_H
|
||||
#ifndef SFML_UDPSOCKETSTRUCT_H
|
||||
#define SFML_UDPSOCKETSTRUCT_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Network/SocketUDP.hpp>
|
||||
#include <SFML/Network/UdpSocket.hpp>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Internal structure of sfSocketUDP
|
||||
// Internal structure of sfUdpSocket
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfSocketUDP
|
||||
struct sfUdpSocket
|
||||
{
|
||||
sf::SocketUDP This;
|
||||
sf::UdpSocket This;
|
||||
};
|
||||
|
||||
|
||||
#endif // SFML_SOCKETUDPSTRUCT_H
|
||||
#endif // SFML_UDPSOCKETSTRUCT_H
|
|
@ -26,7 +26,7 @@ EXPORTS
|
|||
sfFtp_GetDirectoryListing
|
||||
sfFtp_ChangeDirectory
|
||||
sfFtp_ParentDirectory
|
||||
sfFtp_MakeDirectory
|
||||
sfFtp_CreateDirectory
|
||||
sfFtp_DeleteDirectory
|
||||
sfFtp_RenameFile
|
||||
sfFtp_DeleteFile
|
||||
|
@ -36,7 +36,7 @@ EXPORTS
|
|||
sfHttpRequest_Destroy
|
||||
sfHttpRequest_SetField
|
||||
sfHttpRequest_SetMethod
|
||||
sfHttpRequest_SetURI
|
||||
sfHttpRequest_SetUri
|
||||
sfHttpRequest_SetHttpVersion
|
||||
sfHttpRequest_SetBody
|
||||
sfHttpResponse_Destroy
|
||||
|
@ -58,29 +58,36 @@ EXPORTS
|
|||
sfIpAddress_GetPublicAddress
|
||||
sfIpAddress_LocalHost
|
||||
sfIpAddress_None
|
||||
sfSocketTCP_Create
|
||||
sfSocketTCP_Destroy
|
||||
sfSocketTCP_SetBlocking
|
||||
sfSocketTCP_Connect
|
||||
sfSocketTCP_Listen
|
||||
sfSocketTCP_Accept
|
||||
sfSocketTCP_Send
|
||||
sfSocketTCP_Receive
|
||||
sfSocketTCP_SendPacket
|
||||
sfSocketTCP_ReceivePacket
|
||||
sfSocketTCP_Close
|
||||
sfSocketTCP_IsValid
|
||||
sfSocketUDP_Create
|
||||
sfSocketUDP_Destroy
|
||||
sfSocketUDP_SetBlocking
|
||||
sfSocketUDP_Bind
|
||||
sfSocketUDP_Unbind
|
||||
sfSocketUDP_Send
|
||||
sfSocketUDP_Receive
|
||||
sfSocketUDP_SendPacket
|
||||
sfSocketUDP_ReceivePacket
|
||||
sfSocketUDP_Close
|
||||
sfSocketUDP_IsValid
|
||||
sfTcpListener_Create
|
||||
sfTcpListener_Destroy
|
||||
sfTcpListener_SetBlocking
|
||||
sfTcpListener_IsBlocking
|
||||
sfTcpListener_Listen
|
||||
sfTcpListener_Accept
|
||||
sfTcpSocket_Create
|
||||
sfTcpSocket_Destroy
|
||||
sfTcpSocket_SetBlocking
|
||||
sfTcpSocket_IsBlocking
|
||||
sfTcpSocket_GetLocalPort
|
||||
sfTcpSocket_GetRemoteAddress
|
||||
sfTcpSocket_GetRemotePort
|
||||
sfTcpSocket_Connect
|
||||
sfTcpSocket_Disconnect
|
||||
sfTcpSocket_Send
|
||||
sfTcpSocket_Receive
|
||||
sfTcpSocket_SendPacket
|
||||
sfTcpSocket_ReceivePacket
|
||||
sfUdpSocket_Create
|
||||
sfUdpSocket_Destroy
|
||||
sfUdpSocket_SetBlocking
|
||||
sfUdpSocket_IsBlocking
|
||||
sfUdpSocket_GetLocalPort
|
||||
sfUdpSocket_Bind
|
||||
sfUdpSocket_Unbind
|
||||
sfUdpSocket_Send
|
||||
sfUdpSocket_Receive
|
||||
sfUdpSocket_SendPacket
|
||||
sfUdpSocket_ReceivePacket
|
||||
sfPacket_Create
|
||||
sfPacket_Copy
|
||||
sfPacket_Destroy
|
||||
|
@ -112,19 +119,17 @@ EXPORTS
|
|||
sfPacket_WriteDouble
|
||||
sfPacket_WriteString
|
||||
sfPacket_WriteWideString
|
||||
sfSelectorTCP_Create
|
||||
sfSelectorTCP_Copy
|
||||
sfSelectorTCP_Destroy
|
||||
sfSelectorTCP_Add
|
||||
sfSelectorTCP_Remove
|
||||
sfSelectorTCP_Clear
|
||||
sfSelectorTCP_Wait
|
||||
sfSelectorTCP_GetSocketReady
|
||||
sfSelectorUDP_Create
|
||||
sfSelectorUDP_Copy
|
||||
sfSelectorUDP_Destroy
|
||||
sfSelectorUDP_Add
|
||||
sfSelectorUDP_Remove
|
||||
sfSelectorUDP_Clear
|
||||
sfSelectorUDP_Wait
|
||||
sfSelectorUDP_GetSocketReady
|
||||
sfSocketSelector_Create
|
||||
sfSocketSelector_Copy
|
||||
sfSocketSelector_Destroy
|
||||
sfSocketSelector_AddTcpListener
|
||||
sfSocketSelector_AddTcpSocket
|
||||
sfSocketSelector_AddUdpSocket
|
||||
sfSocketSelector_RemoveTcpListener
|
||||
sfSocketSelector_RemoveTcpSocket
|
||||
sfSocketSelector_RemoveUdpSocket
|
||||
sfSocketSelector_Clear
|
||||
sfSocketSelector_Wait
|
||||
sfSocketSelector_IsTcpListenerReady
|
||||
sfSocketSelector_IsTcpSocketReady
|
||||
sfSocketSelector_IsUdpSocketReady
|
||||
|
|
|
@ -26,7 +26,7 @@ EXPORTS
|
|||
sfFtp_GetDirectoryListing
|
||||
sfFtp_ChangeDirectory
|
||||
sfFtp_ParentDirectory
|
||||
sfFtp_MakeDirectory
|
||||
sfFtp_CreateDirectory
|
||||
sfFtp_DeleteDirectory
|
||||
sfFtp_RenameFile
|
||||
sfFtp_DeleteFile
|
||||
|
@ -36,7 +36,7 @@ EXPORTS
|
|||
sfHttpRequest_Destroy
|
||||
sfHttpRequest_SetField
|
||||
sfHttpRequest_SetMethod
|
||||
sfHttpRequest_SetURI
|
||||
sfHttpRequest_SetUri
|
||||
sfHttpRequest_SetHttpVersion
|
||||
sfHttpRequest_SetBody
|
||||
sfHttpResponse_Destroy
|
||||
|
@ -58,31 +58,36 @@ EXPORTS
|
|||
sfIpAddress_GetPublicAddress
|
||||
sfIpAddress_LocalHost
|
||||
sfIpAddress_None
|
||||
sfSocketTCP_Create
|
||||
sfSocketTCP_Copy
|
||||
sfSocketTCP_Destroy
|
||||
sfSocketTCP_SetBlocking
|
||||
sfSocketTCP_Connect
|
||||
sfSocketTCP_Listen
|
||||
sfSocketTCP_Accept
|
||||
sfSocketTCP_Send
|
||||
sfSocketTCP_Receive
|
||||
sfSocketTCP_SendPacket
|
||||
sfSocketTCP_ReceivePacket
|
||||
sfSocketTCP_Close
|
||||
sfSocketTCP_IsValid
|
||||
sfSocketUDP_Create
|
||||
sfSocketUDP_Copy
|
||||
sfSocketUDP_Destroy
|
||||
sfSocketUDP_SetBlocking
|
||||
sfSocketUDP_Bind
|
||||
sfSocketUDP_Unbind
|
||||
sfSocketUDP_Send
|
||||
sfSocketUDP_Receive
|
||||
sfSocketUDP_SendPacket
|
||||
sfSocketUDP_ReceivePacket
|
||||
sfSocketUDP_Close
|
||||
sfSocketUDP_IsValid
|
||||
sfTcpListener_Create
|
||||
sfTcpListener_Destroy
|
||||
sfTcpListener_SetBlocking
|
||||
sfTcpListener_IsBlocking
|
||||
sfTcpListener_Listen
|
||||
sfTcpListener_Accept
|
||||
sfTcpSocket_Create
|
||||
sfTcpSocket_Destroy
|
||||
sfTcpSocket_SetBlocking
|
||||
sfTcpSocket_IsBlocking
|
||||
sfTcpSocket_GetLocalPort
|
||||
sfTcpSocket_GetRemoteAddress
|
||||
sfTcpSocket_GetRemotePort
|
||||
sfTcpSocket_Connect
|
||||
sfTcpSocket_Disconnect
|
||||
sfTcpSocket_Send
|
||||
sfTcpSocket_Receive
|
||||
sfTcpSocket_SendPacket
|
||||
sfTcpSocket_ReceivePacket
|
||||
sfUdpSocket_Create
|
||||
sfUdpSocket_Destroy
|
||||
sfUdpSocket_SetBlocking
|
||||
sfUdpSocket_IsBlocking
|
||||
sfUdpSocket_GetLocalPort
|
||||
sfUdpSocket_Bind
|
||||
sfUdpSocket_Unbind
|
||||
sfUdpSocket_Send
|
||||
sfUdpSocket_Receive
|
||||
sfUdpSocket_SendPacket
|
||||
sfUdpSocket_ReceivePacket
|
||||
sfPacket_Create
|
||||
sfPacket_Copy
|
||||
sfPacket_Destroy
|
||||
|
@ -114,19 +119,17 @@ EXPORTS
|
|||
sfPacket_WriteDouble
|
||||
sfPacket_WriteString
|
||||
sfPacket_WriteWideString
|
||||
sfSelectorTCP_Create
|
||||
sfSelectorTCP_Copy
|
||||
sfSelectorTCP_Destroy
|
||||
sfSelectorTCP_Add
|
||||
sfSelectorTCP_Remove
|
||||
sfSelectorTCP_Clear
|
||||
sfSelectorTCP_Wait
|
||||
sfSelectorTCP_GetSocketReady
|
||||
sfSelectorUDP_Create
|
||||
sfSelectorUDP_Copy
|
||||
sfSelectorUDP_Destroy
|
||||
sfSelectorUDP_Add
|
||||
sfSelectorUDP_Remove
|
||||
sfSelectorUDP_Clear
|
||||
sfSelectorUDP_Wait
|
||||
sfSelectorUDP_GetSocketReady
|
||||
sfSocketSelector_Create
|
||||
sfSocketSelector_Copy
|
||||
sfSocketSelector_Destroy
|
||||
sfSocketSelector_AddTcpListener
|
||||
sfSocketSelector_AddTcpSocket
|
||||
sfSocketSelector_AddUdpSocket
|
||||
sfSocketSelector_RemoveTcpListener
|
||||
sfSocketSelector_RemoveTcpSocket
|
||||
sfSocketSelector_RemoveUdpSocket
|
||||
sfSocketSelector_Clear
|
||||
sfSocketSelector_Wait
|
||||
sfSocketSelector_IsTcpListenerReady
|
||||
sfSocketSelector_IsTcpSocketReady
|
||||
sfSocketSelector_IsUdpSocketReady
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue