From 490d36e65ac24e34e3021c2a0947384aee138c88 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Wed, 13 Apr 2016 21:05:14 -0400 Subject: Root commit for new Compass repository This is the Alpha version of ComPASS, originally developed sometime in 2014. --- Socket.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Socket.cpp (limited to 'Socket.cpp') diff --git a/Socket.cpp b/Socket.cpp new file mode 100644 index 0000000..c90a607 --- /dev/null +++ b/Socket.cpp @@ -0,0 +1,46 @@ +#include "Socket.h" + +Socket::Socket() { + /*memset(&hostInfo, 0, sizeof(hostInfo)); + hostInfo.ai_family = AF_UNSPEC; + hostInfo.ai_socktype = SOCK_STREAM;*/ +} + +Socket::~Socket() { + /*freeaddrinfo(hostInfoList); + clo();*/ +} + +void Socket::conn(std::string host, std::string port) { + throw 1; + /*int status; + status = getaddrinfo(host.c_str(), port.c_str(), &hostInfo, &hostInfoList); + if (status) throw 1; + + sockid = socket(hostInfoList->ai_family, hostInfoList->ai_socktype, hostInfoList->ai_protocol); + if (sockid == -1) throw 1; + + status = connect(sockid, hostInfoList->ai_addr, hostInfoList->ai_addrlen); + if (status) throw 1;*/ +} + +void Socket::sendline(std::string line) { + throw 1; + /*ssize_t bytesSent; + + do { + int len = line.size(); + bytesSent = send(sockid, line.c_str(), len, 0); + + line = line.substr(bytesSent, line.size() - bytesSent); + } while (line.size() > 0); + + send(sockid, "\n", 1, 0); // add \n*/ +} + +std::string Socket::readline() { + throw 1; +} + +void Socket::clo() { +} -- cgit v1.2.3