#include "tcpSocket.h"
#include <stdio.h>

int main(void){
	 tSocket aSocket;
    int i;

    printf("Socket test\n");
    printf(" creating Socket\n");
    
    if (&aSocket == NULL){
	     printf("NULL!!!");
	 }

    if (createSocket(&aSocket, "localhost", 80) != NULL)
		 printf(" done\n");
	 else
		 printf(" ERROR!\n");

	 fflush(stdout);
	 
    printf(" connecting Socket\n");
    if (connectSocket(&aSocket) != NULL)
		 printf(" done\n");
	 else
		 printf(" ERROR!\n");
	 fflush(stdout);
	 if (writeLineToSocket(&aSocket, "GET"))
		 printf("GET request send.\n");
	 else
		 printf("GET request not send!\n");
		 
	 for (i=0; i<=16; i++){
	    printf("%c", readCharFromSocket(&aSocket));
	 }
    printf("\n");
    return 0;
}