summaryrefslogtreecommitdiffstats
path: root/Socket.cpp
blob: c90a6073b481eabcf57b6f4d71b70242020cefcb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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() {
}