mirror of
https://github.com/debauchee/barrier.git
synced 2026-02-09 05:13:36 +08:00
Started over.
This commit is contained in:
84
net/XSocket.cpp
Normal file
84
net/XSocket.cpp
Normal file
@@ -0,0 +1,84 @@
|
||||
#include "XSocket.h"
|
||||
|
||||
//
|
||||
// XSocketAddress
|
||||
//
|
||||
|
||||
XSocketAddress::XSocketAddress(Error error,
|
||||
const CString& hostname, SInt16 port) throw() :
|
||||
m_error(error),
|
||||
m_hostname(hostname),
|
||||
m_port(port)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
XSocketAddress::Error XSocketAddress::getError() const throw()
|
||||
{
|
||||
return m_error;
|
||||
}
|
||||
|
||||
CString XSocketAddress::getHostname() const throw()
|
||||
{
|
||||
return m_hostname;
|
||||
}
|
||||
|
||||
SInt16 XSocketAddress::getPort() const throw()
|
||||
{
|
||||
return m_port;
|
||||
}
|
||||
|
||||
CString XSocketAddress::getWhat() const throw()
|
||||
{
|
||||
return "no address";
|
||||
/*
|
||||
return format("XSocketAddress", "no address: %1:%2",
|
||||
m_hostname.t_str(),
|
||||
CString::sprintf("%d", m_port).t_str());
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XSocketErrno
|
||||
//
|
||||
|
||||
XSocketErrno::XSocketErrno() : MXErrno()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
XSocketErrno::XSocketErrno(int err) : MXErrno(err)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XSocketBind
|
||||
//
|
||||
|
||||
CString XSocketBind::getWhat() const throw()
|
||||
{
|
||||
return format("XSocketBind", "cannot bind address");
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XSocketConnect
|
||||
//
|
||||
|
||||
CString XSocketConnect::getWhat() const throw()
|
||||
{
|
||||
return format("XSocketConnect", "cannot connect socket");
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XSocketCreate
|
||||
//
|
||||
|
||||
CString XSocketCreate::getWhat() const throw()
|
||||
{
|
||||
return format("XSocketCreate", "cannot create socket");
|
||||
}
|
||||
Reference in New Issue
Block a user