2
* synergy -- mouse and keyboard sharing utility
3
* Copyright (C) 2002 Chris Schoeneman
5
* This package is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* found in the file COPYING that should have accompanied this file.
9
* This package is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
16
#include "CStringUtil.h"
22
XSocketAddress::XSocketAddress(EError error,
23
const CString& hostname, int port) throw() :
31
XSocketAddress::EError
32
XSocketAddress::getError() const throw()
38
XSocketAddress::getHostname() const throw()
44
XSocketAddress::getPort() const throw()
50
XSocketAddress::getWhat() const throw()
52
static const char* s_errorID[] = {
53
"XSocketAddressUnknown",
54
"XSocketAddressNotFound",
55
"XSocketAddressNoAddress",
56
"XSocketAddressBadPort"
58
static const char* s_errorMsg[] = {
59
"unknown error for: %{1}:%{2}",
60
"address not found for: %{1}",
61
"no address for: %{1}",
62
"invalid port" // m_port may not be set to the bad port
64
return format(s_errorID[m_error], s_errorMsg[m_error],
66
CStringUtil::print("%d", m_port).c_str());
75
XSocketIOClose::getWhat() const throw()
77
return format("XSocketIOClose", "close: %{1}", what());
86
XSocketBind::getWhat() const throw()
88
return format("XSocketBind", "cannot bind address: %{1}", what());
97
XSocketConnect::getWhat() const throw()
99
return format("XSocketConnect", "cannot connect socket: %{1}", what());
108
XSocketCreate::getWhat() const throw()
110
return format("XSocketCreate", "cannot create socket: %{1}", what());