mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Added the TcpListener::Close function
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1585 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
16d986c762
commit
61dc7e0100
@ -60,7 +60,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sound", "..\..\examples\bui
|
|||||||
{C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8}
|
{C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sound-capture", "..\..\examples\build\vc2008\sound-capture.vcproj", "{34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sound_capture", "..\..\examples\build\vc2008\sound-capture.vcproj", "{34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}
|
{B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}
|
||||||
{C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8}
|
{C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8}
|
||||||
|
@ -79,6 +79,17 @@ public :
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Status Listen(unsigned short port);
|
Status Listen(unsigned short port);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Stop listening and close the socket
|
||||||
|
///
|
||||||
|
/// This function gracefully stops the listener. If the
|
||||||
|
/// socket is not listening, this function has no effect.
|
||||||
|
///
|
||||||
|
/// \see Listen
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
void Close();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Accept a new connection
|
/// \brief Accept a new connection
|
||||||
///
|
///
|
||||||
@ -110,16 +121,21 @@ public :
|
|||||||
/// a given port and waits for connections on that port.
|
/// a given port and waits for connections on that port.
|
||||||
/// This is all it can do.
|
/// This is all it can do.
|
||||||
///
|
///
|
||||||
/// When a new connection is received, the socket returns a
|
/// When a new connection is received, you must call Accept and
|
||||||
/// new instance of sf::TcpSocket that is properly
|
/// the listener returns a new instance of sf::TcpSocket that
|
||||||
/// initialized and can be used to communicate with the
|
/// is properly initialized and can be used to communicate with
|
||||||
/// new client.
|
/// the new client.
|
||||||
///
|
///
|
||||||
/// Listener sockets are specific to the TCP protocol,
|
/// Listener sockets are specific to the TCP protocol,
|
||||||
/// UDP sockets are connectionless and can therefore communicate
|
/// UDP sockets are connectionless and can therefore communicate
|
||||||
/// directly. As a consequence, a listener socket will always
|
/// directly. As a consequence, a listener socket will always
|
||||||
/// return the new connections as sf::TcpSocket instances.
|
/// return the new connections as sf::TcpSocket instances.
|
||||||
///
|
///
|
||||||
|
/// A listener is automatically closed on destruction, like all
|
||||||
|
/// other types of socket. However if you want to stop listening
|
||||||
|
/// before the socket is destroyed, you can call its Close()
|
||||||
|
/// function.
|
||||||
|
///
|
||||||
/// Usage example:
|
/// Usage example:
|
||||||
/// \code
|
/// \code
|
||||||
/// // Create a listener socket and make it wait for new
|
/// // Create a listener socket and make it wait for new
|
||||||
|
@ -87,6 +87,14 @@ Socket::Status TcpListener::Listen(unsigned short port)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
void TcpListener::Close()
|
||||||
|
{
|
||||||
|
// Simply close the socket
|
||||||
|
Socket::Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Socket::Status TcpListener::Accept(TcpSocket& socket)
|
Socket::Status TcpListener::Accept(TcpSocket& socket)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user