summaryrefslogtreecommitdiff
path: root/lib/socket.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/socket.cc')
-rw-r--r--lib/socket.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/lib/socket.cc b/lib/socket.cc
index 2ae88dc..6189d23 100644
--- a/lib/socket.cc
+++ b/lib/socket.cc
@@ -27,19 +27,18 @@
#include <config.h>
#include "socket.h"
+#include "info.h"
#include <errno.h>
-Socket::Socket(Info *ginfo)
+Socket::Socket()
{
- info = ginfo;
connected = false;
err = 0;
}
-Socket::Socket(u_short port, Info *ginfo)
+Socket::Socket(u_short port)
{
- info = ginfo;
connected = false;
err = 0;
@@ -51,7 +50,7 @@ Socket::Socket(u_short port, Info *ginfo)
if (ssocket < 0) {
err = 1;
- info->error("Socket: socket() failed!");
+ MIaV::info->error("Socket: socket() failed!");
}
socketaddr.sin_family = AF_INET; // Use "internet protocol" IP
@@ -71,10 +70,10 @@ Socket::~Socket()
Socket Socket::slisten()
{
- Socket s = Socket(info);
+ Socket s;
if(err) {
- //info->error("Socket: No socket present!");
+ //MIaV::info->error("Socket: No socket present!");
return s;
}
if(!connected) {
@@ -82,7 +81,7 @@ Socket Socket::slisten()
err = bind(ssocket, (struct sockaddr*)&socketaddr, sizeof(socketaddr));
if (err) {
- info->error("Socket: bind() failed! %s", strerror(errno));
+ MIaV::info->error("Socket: bind() failed! %s", strerror(errno));
return s;
}
@@ -90,7 +89,7 @@ Socket Socket::slisten()
// requests (max 5 in queue)
err = listen(ssocket, 5);
if(err) {
- info->error("Socket: listen() failed! %s", strerror(errno));
+ MIaV::info->error("Socket: listen() failed! %s", strerror(errno));
return s;
}
}
@@ -105,7 +104,7 @@ Socket Socket::slisten()
if (s.ssocket < 0) {
s.connected = false;
err = 1;
- info->error("Socket: accept() failed! %s", strerror(errno));
+ MIaV::info->error("Socket: accept() failed! %s", strerror(errno));
return s;
}
@@ -119,7 +118,7 @@ int Socket::sconnect(char *ip)
{
if(err) {
connected = false;
- info->error("Socket: No socket present!");
+ MIaV::info->error("Socket: No socket present!");
return err;
}
@@ -130,7 +129,7 @@ int Socket::sconnect(char *ip)
err = connect(ssocket, (struct sockaddr*)&socketaddr, sizeof(socketaddr));
if (err) {
connected = false;
- info->error("Socket: connect() failed! %s", strerror(errno));
+ MIaV::info->error("Socket: connect() failed! %s", strerror(errno));
return err;
}
// fprintf(stderr, "Socket connected\n");