Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-02-16 12:22:33 +0000
committerStijn Buys <ingar@osirion.org>2008-02-16 12:22:33 +0000
commitd6ee7ec642cc6b3097c8d321a1a00630e24027d1 (patch)
tree35f56e5168cc3e12724898b9efb81b4b2938f575 /src/net
parent715d0c3952a3a1d59b64074e472d0a9a3b414351 (diff)
initial client-to-server connection
Diffstat (limited to 'src/net')
-rw-r--r--src/net/tcpconnection.cc16
-rw-r--r--src/net/tcpconnection.h2
2 files changed, 9 insertions, 9 deletions
diff --git a/src/net/tcpconnection.cc b/src/net/tcpconnection.cc
index 92bc3d2..e4ff009 100644
--- a/src/net/tcpconnection.cc
+++ b/src/net/tcpconnection.cc
@@ -83,10 +83,10 @@ void TCPConnection::disconnect()
tcpconnection_error = false;
tcpconnection_host.clear();
tcpconnection_port = 0;
- con_debug << "Network disconnected from server" << std::endl;
+ //con_debug << "Network disconnected from server" << std::endl;
}
-void TCPConnection::connect(std::string to_host, int to_port)
+void TCPConnection::connect(std::string const &to_host, int to_port)
{
if (valid())
return;
@@ -95,7 +95,7 @@ void TCPConnection::connect(std::string to_host, int to_port)
struct hostent *serverhostent;
serverhostent = gethostbyname(to_host.c_str());
if (!serverhostent) {
- con_warn << "Network can't resolve " << to_host.c_str() << "!" << std::endl;
+ con_warn << "Could not resolve '" << to_host.c_str() << "'" << std::endl;
abort();
return;
}
@@ -105,7 +105,7 @@ void TCPConnection::connect(std::string to_host, int to_port)
// Get a socket file descriptor
tcpconnection_fd = socket(PF_INET, SOCK_STREAM, 0);
if (tcpconnection_fd == -1) {
- con_error << "Network socket() failed!" << std::endl;
+ //con_error << "Network socket() failed!" << std::endl;
abort();
return;
}
@@ -118,7 +118,7 @@ void TCPConnection::connect(std::string to_host, int to_port)
memset(server_addr.sin_zero, '\0', sizeof server_addr.sin_zero);
if (::connect(tcpconnection_fd, (struct sockaddr *)&server_addr, sizeof(struct sockaddr)) != 0) {
- con_error << "Network connect() failed!" << std::endl;
+ //con_error << "Network connect() failed!" << std::endl;
abort();
return;
}
@@ -126,7 +126,7 @@ void TCPConnection::connect(std::string to_host, int to_port)
tcpconnection_host = to_host;
tcpconnection_port = to_port;
tcpconnection_error = false;
- con_print << "Connected to server." << std::endl;
+ //con_print << "Connected to server." << std::endl;
}
@@ -147,7 +147,7 @@ void TCPConnection::receive(std::string &msg)
return;
} else if (bytes_received < 0) {
con_error << "Network receive() error!" << std::endl;
- perror("recv");
+ //perror("recv");
abort();
return;
}
@@ -172,7 +172,7 @@ void TCPConnection::send(std::string const &msg)
bytes_sent = ::send(tcpconnection_fd, sendbuf.c_str(), sendbuf.size(), 0);
if (bytes_sent < 0) {
con_error << "Network send() error!" << std::endl;
- perror("send");
+ //perror("send");
abort();
return;
}
diff --git a/src/net/tcpconnection.h b/src/net/tcpconnection.h
index 7e71ed0..6076215 100644
--- a/src/net/tcpconnection.h
+++ b/src/net/tcpconnection.h
@@ -46,7 +46,7 @@ public:
int fd() const;
/// connect to a remote host
- virtual void connect(std::string to_host, int to_port);
+ virtual void connect(std::string const &to_host, int to_port);
/// disconnect from a remote host
virtual void disconnect();