//Main CLIENT
#include <iostream>
#include "../libnetwork/psocket_init.h"
#include "../definition_ports.h"

int main(int argc, char **argv) {
	std::cout << "Hello, world client!" << std::endl;
	int sockfd = createTCPsocketClient("localhost", PORT);
	int numbytes;
	char buffer[MAXDATASIZE];
	printf("When you're writting something, skip the spaces.\n");
	int quit = 0, len;
	while (!quit){
		printf("Write something:\n>");
		scanf("%s", buffer);
		len = strlen(buffer) + 1;
		
		if(send(sockfd, (void *)buffer, len, 0) == -1){fprintf(stderr, "Error send\n");exit(EXIT_FAILURE);}
		
		if(strcmp(buffer, "exit") == 0) quit = 1;
		if(strcmp(buffer, "quit") == 0) quit = 1;
	}
	close(sockfd);
	return 0;
}


