src/Network/Socket.cc
author terom
Tue, 09 Dec 2008 04:40:05 +0000
changeset 367 5114fbb7ec03
parent 187 f41f894213ca
child 378 5589abf5e61b
permissions -rw-r--r--
fix more optimized-assert errors
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