#include "socketio.hpp"
#include "BigInt.hpp"
#include <iostream>
#include <chrono>
template<typename T>
std::ostream& operator<<(std::ostream& out, std::vector<T> o){
	out << "[";
	for(unsigned int i = 0;i < o.size();i++){
		if(o[i] == '\r')continue;
		out << o[i];
		if(i < o.size() - 1)
			out << ", ";
	}
	return out << "]";
}
template<>
std::ostream& operator<< <char>(std::ostream& out, std::vector<char> o){
	for(unsigned int i = 0;i < o.size();i++){
		out << o[i];
	}
	return out;
}
int main(){
	BigInt<2> a = (1ULL << 35);
	std::cout << a << "\n";
}
int mian(){
	cppsocket sock("192.168.178.79", 80);
	//cppsocket sock("127.0.0.1", 80);
	std::vector<char> toSend(10);
	for(unsigned int i = 0;i < toSend.size();i++){
		toSend[i] = (char)(i * i) % 10 + 'a';
	}
	//std::cout << errno << std::endl;
	try{
		for(int i = 0;i < 100;i++){
			sock.write(toSend);
			std::cout << "Rec" << std::endl;
			std::cout << sock.receive() << std::endl;
			//std::this_thread::sleep_for(std::chrono::milliseconds(1));
		}
	}
	catch(std::exception& e){
		std::cout << e.what() << std::endl;
	}
	//std::cout << "Sent "  << std::to_string(toSend.size()) << ", Receiving..." << std::endl;
	//sock.write(std::vector<char>(1,1));
	//std::vector<char> vec = sock.receive();
	//std::cout << (vec == toSend);
	//std::cout << vec << std::endl;
	//vec = sock.receive();
	//std::cout << vec << std::endl;
	return 0;
}
