summaryrefslogtreecommitdiff
path: root/lib/socket.cc
diff options
context:
space:
mode:
authordeva <deva>2006-07-20 17:53:04 +0000
committerdeva <deva>2006-07-20 17:53:04 +0000
commitc8df40b62cf30029a4acd1a57c8c54add54dda9b (patch)
tree42d06a4d502c6e0fd0cdbf7f836fdaffd847efa5 /lib/socket.cc
parenta09f1b932560f11caf34a567ee226446a496a584 (diff)
Utilized the global info object.
Utilized the global info object.
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");