summaryrefslogtreecommitdiff
path: root/include/SFML/Network
diff options
context:
space:
mode:
authorChristoph Egger <Christoph.Egger@gmx.de>2008-06-22 11:08:22 +0200
committerChristoph Egger <Christoph.Egger@gmx.de>2008-06-22 11:08:22 +0200
commit19199f59628f0187703b21abc6e1af7e303f56a2 (patch)
tree7adcc5985de0766f23d2d5ec3fbac3098e2fa9e9 /include/SFML/Network
parent4b040a97527868d87cf70814c44340be2a3f7e78 (diff)
Imported Upstream version 1.3
Diffstat (limited to 'include/SFML/Network')
-rwxr-xr-xinclude/SFML/Network/IPAddress.hpp2
-rwxr-xr-xinclude/SFML/Network/Packet.hpp46
-rwxr-xr-xinclude/SFML/Network/Selector.hpp44
-rwxr-xr-xinclude/SFML/Network/Selector.inl83
-rwxr-xr-xinclude/SFML/Network/SelectorBase.hpp112
-rwxr-xr-xinclude/SFML/Network/SocketHelper.hpp2
-rwxr-xr-xinclude/SFML/Network/SocketTCP.hpp9
-rwxr-xr-xinclude/SFML/Network/SocketUDP.hpp10
-rwxr-xr-xinclude/SFML/Network/Sockets.hpp2
-rwxr-xr-xinclude/SFML/Network/Unix/SocketHelper.hpp190
-rwxr-xr-xinclude/SFML/Network/Win32/SocketHelper.hpp2
11 files changed, 310 insertions, 192 deletions
diff --git a/include/SFML/Network/IPAddress.hpp b/include/SFML/Network/IPAddress.hpp
index c28e600..5721623 100755
--- a/include/SFML/Network/IPAddress.hpp
+++ b/include/SFML/Network/IPAddress.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 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.
diff --git a/include/SFML/Network/Packet.hpp b/include/SFML/Network/Packet.hpp
index 4d9631a..738dfce 100755
--- a/include/SFML/Network/Packet.hpp
+++ b/include/SFML/Network/Packet.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 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.
@@ -99,31 +99,35 @@ public :
/// Operator >> overloads to extract data from the packet
///
////////////////////////////////////////////////////////////
- Packet& operator >>(Int8& Data);
- Packet& operator >>(Uint8& Data);
- Packet& operator >>(Int16& Data);
- Packet& operator >>(Uint16& Data);
- Packet& operator >>(Int32& Data);
- Packet& operator >>(Uint32& Data);
- Packet& operator >>(float& Data);
- Packet& operator >>(double& Data);
- Packet& operator >>(char* Data);
- Packet& operator >>(std::string& Data);
+ Packet& operator >>(Int8& Data);
+ Packet& operator >>(Uint8& Data);
+ Packet& operator >>(Int16& Data);
+ Packet& operator >>(Uint16& Data);
+ Packet& operator >>(Int32& Data);
+ Packet& operator >>(Uint32& Data);
+ Packet& operator >>(float& Data);
+ Packet& operator >>(double& Data);
+ Packet& operator >>(char* Data);
+ Packet& operator >>(std::string& Data);
+ Packet& operator >>(wchar_t* Data);
+ Packet& operator >>(std::wstring& Data);
////////////////////////////////////////////////////////////
/// Operator << overloads to put data into the packet
///
////////////////////////////////////////////////////////////
- Packet& operator <<(Int8 Data);
- Packet& operator <<(Uint8 Data);
- Packet& operator <<(Int16 Data);
- Packet& operator <<(Uint16 Data);
- Packet& operator <<(Int32 Data);
- Packet& operator <<(Uint32 Data);
- Packet& operator <<(float Data);
- Packet& operator <<(double Data);
- Packet& operator <<(const char* Data);
- Packet& operator <<(const std::string& Data);
+ Packet& operator <<(Int8 Data);
+ Packet& operator <<(Uint8 Data);
+ Packet& operator <<(Int16 Data);
+ Packet& operator <<(Uint16 Data);
+ Packet& operator <<(Int32 Data);
+ Packet& operator <<(Uint32 Data);
+ Packet& operator <<(float Data);
+ Packet& operator <<(double Data);
+ Packet& operator <<(const char* Data);
+ Packet& operator <<(const std::string& Data);
+ Packet& operator <<(const wchar_t* Data);
+ Packet& operator <<(const std::wstring& Data);
private :
diff --git a/include/SFML/Network/Selector.hpp b/include/SFML/Network/Selector.hpp
index a993937..7d1c320 100755
--- a/include/SFML/Network/Selector.hpp
+++ b/include/SFML/Network/Selector.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 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.
@@ -30,7 +30,8 @@
////////////////////////////////////////////////////////////
#include <SFML/Network/SocketUDP.hpp>
#include <SFML/Network/SocketTCP.hpp>
-#include <vector>
+#include <SFML/Network/SelectorBase.hpp>
+#include <map>
namespace sf
@@ -40,17 +41,11 @@ namespace sf
/// without blocking. It's a kind of multiplexer
////////////////////////////////////////////////////////////
template <typename Type>
-class Selector
+class Selector : private SelectorBase
{
public :
////////////////////////////////////////////////////////////
- /// Default constructor
- ///
- ////////////////////////////////////////////////////////////
- Selector();
-
- ////////////////////////////////////////////////////////////
/// Add a socket to watch
///
/// \param Socket : Socket to add
@@ -73,25 +68,40 @@ public :
void Clear();
////////////////////////////////////////////////////////////
- /// Retrieve all the sockets of the selector which are
- /// ready for reading or writing. This functions will return
- /// either when at least one socket is ready, or when given time is out
+ /// 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
///
- /// \param Sockets : Array to fill with sockets that are ready for reading
/// \param Timeout : Timeout, in seconds (0 by default : no timeout)
///
- /// \return True if a socket is ready, false if time was out
+ /// \return Number of sockets ready to be read
///
////////////////////////////////////////////////////////////
- bool GetSocketsReady(std::vector<Type>& Sockets, float Timeout = 0.f);
+ unsigned int Wait(float Timeout = 0.f);
+
+ ////////////////////////////////////////////////////////////
+ /// 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()
+ ///
+ /// \param Index : Index of the socket to get
+ ///
+ /// \return The Index-th socket
+ ///
+ ////////////////////////////////////////////////////////////
+ Type GetSocketReady(unsigned int Index) const;
private :
////////////////////////////////////////////////////////////
+ // Types
+ ////////////////////////////////////////////////////////////
+ typedef std::map<SocketHelper::SocketType, Type> SocketTable;
+
+ ////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- fd_set mySet; ///< Set of socket to watch
- int myMaxSocket; ///< Maximum socket index
+ SocketTable mySockets; ///< Table matching the SFML socket instances with their low-level handles
};
#include <SFML/Network/Selector.inl>
diff --git a/include/SFML/Network/Selector.inl b/include/SFML/Network/Selector.inl
index 10f4b21..9eacb6f 100755
--- a/include/SFML/Network/Selector.inl
+++ b/include/SFML/Network/Selector.inl
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 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.
@@ -24,26 +24,16 @@
////////////////////////////////////////////////////////////
-/// Default constructor
-////////////////////////////////////////////////////////////
-template <typename Type>
-Selector<Type>::Selector() :
-myMaxSocket(0)
-{
- Clear();
-}
-
-
-////////////////////////////////////////////////////////////
/// Add a socket to watch
////////////////////////////////////////////////////////////
template <typename Type>
void Selector<Type>::Add(Type Socket)
{
- FD_SET(Socket.mySocket, &mySet);
-
- if (static_cast<int>(Socket.mySocket) > myMaxSocket)
- myMaxSocket = static_cast<int>(Socket.mySocket);
+ if (Socket.IsValid())
+ {
+ SelectorBase::Add(Socket.mySocket);
+ mySockets[Socket.mySocket] = Socket;
+ }
}
@@ -53,7 +43,12 @@ void Selector<Type>::Add(Type Socket)
template <typename Type>
void Selector<Type>::Remove(Type Socket)
{
- FD_CLR(Socket.mySocket, &mySet);
+ typename SocketTable::iterator It = mySockets.find(Socket.mySocket);
+ if (It != mySockets.end())
+ {
+ SelectorBase::Remove(Socket.mySocket);
+ mySockets.erase(It);
+ }
}
@@ -63,46 +58,40 @@ void Selector<Type>::Remove(Type Socket)
template <typename Type>
void Selector<Type>::Clear()
{
- FD_ZERO(&mySet);
-
- myMaxSocket = 0;
+ SelectorBase::Clear();
+ mySockets.clear();
}
////////////////////////////////////////////////////////////
-/// Retrieve all the sockets of the selector which are
-/// ready for reading or writing. This functions will return
-/// either when at least one socket is ready, or when given time is out
+/// 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
////////////////////////////////////////////////////////////
template <typename Type>
-bool Selector<Type>::GetSocketsReady(std::vector<Type>& Sockets, float Timeout)
+unsigned int Selector<Type>::Wait(float Timeout)
{
- // First of all, clear the array to fill...
- Sockets.clear();
+ // No socket in the selector : return 0
+ if (mySockets.empty())
+ return 0;
- // Setup the timeout structure
- timeval Time;
- Time.tv_sec = static_cast<long>(Timeout);
- Time.tv_usec = (static_cast<long>(Timeout * 1000) % 1000) * 1000;
+ return SelectorBase::Wait(Timeout);
+}
- // Use a copy of the set, as it will be modified by select()
- fd_set Set = mySet;
- // Wait until one of the sockets is ready for reading, or timeout is reached
- if (select(myMaxSocket + 1, &Set, NULL, NULL, Timeout > 0 ? &Time : NULL) != 0)
- {
- // One or more sockets are ready : put them into the array
- for (int i = 0; i < myMaxSocket + 1; ++i)
- {
- if (FD_ISSET(i, &Set))
- Sockets.push_back(Type(static_cast<SocketHelper::SocketType>(i)));
- }
+////////////////////////////////////////////////////////////
+/// 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()
+////////////////////////////////////////////////////////////
+template <typename Type>
+Type Selector<Type>::GetSocketReady(unsigned int Index) const
+{
+ SocketHelper::SocketType Socket = SelectorBase::GetSocketReady(Index);
- return true;
- }
+ typename SocketTable::const_iterator It = mySockets.find(Socket);
+ if (It != mySockets.end())
+ return It->second;
else
- {
- // Timeout reached...
- return false;
- }
+ return Type(Socket);
}
diff --git a/include/SFML/Network/SelectorBase.hpp b/include/SFML/Network/SelectorBase.hpp
new file mode 100755
index 0000000..103c103
--- /dev/null
+++ b/include/SFML/Network/SelectorBase.hpp
@@ -0,0 +1,112 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2008 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_SELECTORBASE_HPP
+#define SFML_SELECTORBASE_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+#include <SFML/Network/SocketHelper.hpp>
+#include <map>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// Private base class for selectors.
+/// As Selector is a template class, this base is needed so that
+/// every system call get compiled in SFML (not inlined)
+////////////////////////////////////////////////////////////
+class SFML_API SelectorBase
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ SelectorBase();
+
+ ////////////////////////////////////////////////////////////
+ /// Add a socket to watch
+ ///
+ /// \param Socket : Socket to add
+ ///
+ ////////////////////////////////////////////////////////////
+ void Add(SocketHelper::SocketType Socket);
+
+ ////////////////////////////////////////////////////////////
+ /// Remove a socket
+ ///
+ /// \param Socket : Socket to remove
+ ///
+ ////////////////////////////////////////////////////////////
+ void Remove(SocketHelper::SocketType Socket);
+
+ ////////////////////////////////////////////////////////////
+ /// Remove all sockets
+ ///
+ ////////////////////////////////////////////////////////////
+ void 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
+ ///
+ /// \param Timeout : Timeout, in seconds (0 by default : no timeout)
+ ///
+ /// \return Number of sockets ready to be read
+ ///
+ ////////////////////////////////////////////////////////////
+ unsigned int Wait(float Timeout = 0.f);
+
+ ////////////////////////////////////////////////////////////
+ /// 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()
+ ///
+ /// \param Index : Index of the socket to get
+ ///
+ /// \return The Index-th socket
+ ///
+ ////////////////////////////////////////////////////////////
+ SocketHelper::SocketType GetSocketReady(unsigned int Index) const;
+
+private :
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ fd_set mySet; ///< Set of socket to watch
+ fd_set mySetReady; ///< Set of socket which are ready for reading
+ int myMaxSocket; ///< Maximum socket index
+};
+
+} // namespace sf
+
+
+#endif // SFML_SELECTORBASE_HPP
diff --git a/include/SFML/Network/SocketHelper.hpp b/include/SFML/Network/SocketHelper.hpp
index 4f7a748..36126db 100755
--- a/include/SFML/Network/SocketHelper.hpp
+++ b/include/SFML/Network/SocketHelper.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 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.
diff --git a/include/SFML/Network/SocketTCP.hpp b/include/SFML/Network/SocketTCP.hpp
index bc6254e..06bcf9e 100755
--- a/include/SFML/Network/SocketTCP.hpp
+++ b/include/SFML/Network/SocketTCP.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 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.
@@ -29,16 +29,15 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Network/SocketHelper.hpp>
+#include <SFML/Network/Packet.hpp>
#include <cstddef>
namespace sf
{
-class Packet;
class IPAddress;
template <typename> class Selector;
-
////////////////////////////////////////////////////////////
/// SocketTCP wraps a socket using TCP protocol to
/// send data safely (but a bit slower)
@@ -211,7 +210,9 @@ private :
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- SocketHelper::SocketType mySocket; ///< Socket descriptor
+ SocketHelper::SocketType mySocket; ///< Socket descriptor
+ sf::Packet myPendingPacket; ///< Current pending packet, if any (in non-blocking mode)
+ Int32 myPendingPacketSize; ///< Size of the current pending packet, if any (in non-blocking mode)
};
} // namespace sf
diff --git a/include/SFML/Network/SocketUDP.hpp b/include/SFML/Network/SocketUDP.hpp
index cca2522..62229b4 100755
--- a/include/SFML/Network/SocketUDP.hpp
+++ b/include/SFML/Network/SocketUDP.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 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.
@@ -29,12 +29,12 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Network/SocketHelper.hpp>
+#include <SFML/Network/Packet.hpp>
#include <cstddef>
namespace sf
{
-class Packet;
class IPAddress;
template <typename> class Selector;
@@ -209,8 +209,10 @@ private :
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- SocketHelper::SocketType mySocket; ///< Socket identifier
- unsigned short myPort; ///< Port to which the socket is bound
+ SocketHelper::SocketType mySocket; ///< Socket identifier
+ unsigned short myPort; ///< Port to which the socket is bound
+ sf::Packet myPendingPacket; ///< Current pending packet, if any (in non-blocking mode)
+ Int32 myPendingPacketSize; ///< Size of the current pending packet, if any (in non-blocking mode)
};
} // namespace sf
diff --git a/include/SFML/Network/Sockets.hpp b/include/SFML/Network/Sockets.hpp
index b0fb8ea..b611e85 100755
--- a/include/SFML/Network/Sockets.hpp
+++ b/include/SFML/Network/Sockets.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 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.
diff --git a/include/SFML/Network/Unix/SocketHelper.hpp b/include/SFML/Network/Unix/SocketHelper.hpp
index caa58bb..8a3b391 100755
--- a/include/SFML/Network/Unix/SocketHelper.hpp
+++ b/include/SFML/Network/Unix/SocketHelper.hpp
@@ -1,95 +1,95 @@
-////////////////////////////////////////////////////////////
-//
-// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 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_SOCKETHELPERUNIX_HPP
-#define SFML_SOCKETHELPERUNIX_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <unistd.h>
-
-
-namespace sf
-{
-////////////////////////////////////////////////////////////
-/// This class defines helper functions to do all the
-/// non-portable socket stuff. This class is meant for internal
-/// use only
-////////////////////////////////////////////////////////////
-class SFML_API SocketHelper
-{
-public :
-
- ////////////////////////////////////////////////////////////
- // Define some socket types
- ////////////////////////////////////////////////////////////
- typedef int SocketType;
- typedef socklen_t LengthType;
-
- ////////////////////////////////////////////////////////////
- /// Return the value of the invalid socket
- ///
- /// \return Unique value of the invalid socket
- ///
- ////////////////////////////////////////////////////////////
- static SocketType InvalidSocket();
-
- ////////////////////////////////////////////////////////////
- /// Close / destroy a socket
- ///
- /// \param Socket : Socket to close
- ///
- /// \return True on success
- ///
- ////////////////////////////////////////////////////////////
- static bool Close(SocketType Socket);
-
- ////////////////////////////////////////////////////////////
- /// Set a socket as blocking or non-blocking
- ///
- /// \param Socket : Socket to modify
- /// \param Block : New blocking state of the socket
- ///
- ////////////////////////////////////////////////////////////
- static void SetBlocking(SocketType Socket, bool Block);
-
- ////////////////////////////////////////////////////////////
- /// Get the last socket error status
- ///
- /// \return Status corresponding to the last socket error
- ///
- ////////////////////////////////////////////////////////////
- static Socket::Status GetErrorStatus();
-};
-
-} // namespace sf
-
-
-#endif // SFML_SOCKETHELPERUNIX_HPP
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007 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_SOCKETHELPERUNIX_HPP
+#define SFML_SOCKETHELPERUNIX_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <unistd.h>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// This class defines helper functions to do all the
+/// non-portable socket stuff. This class is meant for internal
+/// use only
+////////////////////////////////////////////////////////////
+class SFML_API SocketHelper
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ // Define some socket types
+ ////////////////////////////////////////////////////////////
+ typedef int SocketType;
+ typedef socklen_t LengthType;
+
+ ////////////////////////////////////////////////////////////
+ /// Return the value of the invalid socket
+ ///
+ /// \return Unique value of the invalid socket
+ ///
+ ////////////////////////////////////////////////////////////
+ static SocketType InvalidSocket();
+
+ ////////////////////////////////////////////////////////////
+ /// Close / destroy a socket
+ ///
+ /// \param Socket : Socket to close
+ ///
+ /// \return True on success
+ ///
+ ////////////////////////////////////////////////////////////
+ static bool Close(SocketType Socket);
+
+ ////////////////////////////////////////////////////////////
+ /// Set a socket as blocking or non-blocking
+ ///
+ /// \param Socket : Socket to modify
+ /// \param Block : New blocking state of the socket
+ ///
+ ////////////////////////////////////////////////////////////
+ static void SetBlocking(SocketType Socket, bool Block);
+
+ ////////////////////////////////////////////////////////////
+ /// Get the last socket error status
+ ///
+ /// \return Status corresponding to the last socket error
+ ///
+ ////////////////////////////////////////////////////////////
+ static Socket::Status GetErrorStatus();
+};
+
+} // namespace sf
+
+
+#endif // SFML_SOCKETHELPERUNIX_HPP
diff --git a/include/SFML/Network/Win32/SocketHelper.hpp b/include/SFML/Network/Win32/SocketHelper.hpp
index ec30f08..d7851b4 100755
--- a/include/SFML/Network/Win32/SocketHelper.hpp
+++ b/include/SFML/Network/Win32/SocketHelper.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 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.