src/Network/Socket.cc
author terom
Wed, 03 Dec 2008 19:40:37 +0000
changeset 187 f41f894213ca
child 378 5589abf5e61b
permissions -rw-r--r--
restructure network code a bit
187
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
     1
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
     2
#include "Socket.hh"
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
     3
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
     4
#include <sstream>
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
     5
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
     6
std::string NetworkSocketError::build_str (const NetworkSocket &socket, const char *op, const char *err) {
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
     7
    std::stringstream ss;
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
     8
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
     9
    ss << "socket #" << socket.get_socket() << " " << op << ": " << err;
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
    10
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
    11
    return ss.str();
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
    12
}
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
    13
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
    14
NetworkSocketError::NetworkSocketError (const NetworkSocket &socket, const char *op, const char *err) :
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
    15
    Error(build_str(socket, op, err)) {
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
    16
    
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
    17
    // nothing
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
    18
}
f41f894213ca restructure network code a bit
terom
parents:
diff changeset
    19