Code:
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
  int sockfd;
  int port;
  char* server=argv[1];
  struct sockaddr_in servaddr;
  char toser[100];
  char fromser[100];
  char tosercpy[100];
  char fromsercpy[100];
  char protocol[20];
  char protocolA[20];
  if(argc<2){ 
	printf("Syntax: ./pusoydos <--host server_ip> [--port port_number] [--version] \n");
	return -EINVAL; 
  }
  if (argc==2){
	port=9034;
  }
  else if (argc==3){
	port=atoi(argv[2]);
  }
  else if (argc == 4){

        showinfo();
	return 0;

  }

  sockfd = socket(PF_INET,SOCK_STREAM,0);
  if(sockfd<0) {
	perror("socket");
	return -EIO;
  }

  bzero(&servaddr, sizeof(servaddr));
  servaddr.sin_family = AF_INET;
  servaddr.sin_port = htons(port);
  inet_pton(AF_INET,server,&servaddr.sin_addr);

  if(connect(sockfd,(struct sockaddr *)&servaddr,sizeof(servaddr))<0){
	perror("connect");
	close(sockfd);
	return -EIO;
  }
  while(1){
	memset(fromser, 0, sizeof(fromser));
	fgets(toser,sizeof(toser),stdin);
	send(sockfd,toser,strlen(toser),0);
	recv(sockfd,fromser,sizeof(fromser),0); 
	strcpy(tosercpy, toser);
	strcpy(fromsercpy,fromser);
	char *protocol;
	char *protocolyou;
	protocol = strtok (fromsercpy,", ");
	protocolyou = strtok(tosercpy,", ");
  if(strcmp(protocolyou,"joingame")==0){
/*don;t know what the content will be*/
  }
  if (strcmp(protocol,"startgame")==0){/*This message is sent by the Game Server to inform the clients that all 4 players have joined and the
game can now start.*/
	printf("StartGame\n");
	int playno;
  }
  if(strcmp(protocol,"initialcards")==0){
	/*This message is sent by the Game Server to each client to provide the shuffled cards.*/
	int count=protocol[1];
	int cardcode[count];
	int ctr;
	for (ctr=0; ctr<count; ct++){
	  strcpy(cardcode[ctr],protocol[ctr+2]);
	}
/*I plan to put the GUI creation part here, after receiving the cards*/
  }
  if (strcmp(protocol,"yourturn")==0){
	printf("YourTurn\n");
	int timeout=protocol[1];

  }
  if(strcmp(protocolyou,"dealcards")==0){/*protocolyou is not actually from fgets but from a button-click signal. How do I do that(?)*/
	printf("DealCards\n");
	protocolyou="dealcards";
	int cardct, ct;
	for (ct=0; ct<cardct; ct++){
	strcat(protocolyou, storedcard[ct]);
  	}
  }
  if (strcmp(protocol,"dealcards_response")==0){
	printf("DealCardsResponse\n");
	if (protocol[1]==pass){
	}
	if (protocol[2]==fail){
	/*buttons submitted reappear*/
	}
  }
  if(strcmp(protocol,"cards")==0){
	printf("Cards\n");
  }
  if (strcmp(protocol,"playerwins")==0){
	printf("DeclareWinner\n");
  }
}
  close(sockfd);
  return 0;
}
the code for sockets there is from the last exercise we had. but they said that threading should be used for this. it's like fork according to them. that is so that we can run simultaneous stuff.

thank you very much for your patience Mr.Adak and friends.