14 #include <ecl/config/ecl.hpp> 19 #include "../../include/ecl/io/sockets.hpp" 29 static bool already_initialised =
false;
30 if ( !already_initialised ) {
31 struct WSAData wsaData;
34 if ( (err = WSAStartup(MAKEWORD(2, 0), &wsaData)) != 0) {
35 switch( WSAGetLastError() ) {
50 #if defined(ECL_IS_WIN32) 51 if ( ::closesocket(socket) == SOCKET_ERROR ) {
52 switch(WSAGetLastError()) {
61 #elif defined(ECL_IS_POSIX) 62 if ( ::close(socket) != 0 ) {
76 if ( WSACleanup() == SOCKET_ERROR ) {
77 switch(WSAGetLastError()) {
int socket_descriptor
Cross-platform typedef for a socket file descriptor.
ecl_io_PUBLIC SocketError init_sockets()
Initialise the socket subsystem.
ecl_io_PUBLIC SocketError close_socket(const socket_descriptor &sock)
Close a socket.
ecl_io_PUBLIC SocketError shutdown_sockets()
Shutdown the socket subsystem.
Extends the generic error handler with socket specific error strings.