예제 #1
0
파일: client.c 프로젝트: clholgat/CSC246
void inp(){
  printf("Hit or stand? ");
  scanf("%s", buf);
  
  if(!strncmp(buf, "hit", 3)){
    send_msg("hit", client_sock);
    in_msg();
  }else if(!strncmp(buf, "stand", 4)){
    send_msg("stand", client_sock);
    in_msg();
  }else{
    inp();
  }
}
예제 #2
0
파일: client.c 프로젝트: clholgat/CSC246
int main( int argc, char *argv[] ) {

  if ( argc != 2 ) {
    printf( "Usage: client SERVER_IP_ADDRESS\n" );
    return 1;
  }

  client_sock = client_connect( argv[ 1 ] );
  
  in_msg(); 
  
  terminate_socket( client_sock );
  return 0; 
}
예제 #3
0
/**
 * Source callback, either performs in or out operation, depending on the event
 * type
 * @param src Underlying monitor source of the message source
 */
static void msg_cb(struct io_src *src)
{
	struct io_src_msg *msg = to_src_msg(src);

	/* TODO treat I/O THEN errors */
	if (io_src_has_error(src))
		return;

	if (io_src_has_in(src)) {
		in_msg(msg, src->fd);
		return;
	}

	out_msg(msg, src->fd);
}
예제 #4
0
파일: client.c 프로젝트: clholgat/CSC246
void tie(){
  printf("Tie\n");
  in_msg();
}
예제 #5
0
파일: client.c 프로젝트: clholgat/CSC246
void lose(){
  printf("Player Loses\n");
  in_msg();
}
예제 #6
0
파일: client.c 프로젝트: clholgat/CSC246
void win(){
  printf("Player Wins\n");
  in_msg();
}
예제 #7
0
파일: client.c 프로젝트: clholgat/CSC246
void msg(){
  recv_msg(buf, 256, client_sock);
  printf("%s", buf);
  in_msg();
}