示例#1
0
文件: server.c 项目: Aiscky/Zappy
void			my_init_serveur(t_server *s_info) {
  fd_set		readfds;
  int			i = 0;
  time_t		*t;
  struct timeval	*time;

  create_socket_s(s_info);
  s_info->graph = 0;
  my_prompt_welc(s_info);
  s_info->list = NULL;
  s_info->egg = NULL;
  create_ele_fct(s_info);
  while (check_victory(s_info) != 1) {
    time->tv_sec= 1;
    FD_ZERO(&readfds);
    FD_SET(socket_s, &readfds);
    parc_sock(s_info);
    s_info->list = parse_list(s_info);
    i = 0;
    while (socket_com[i].socket != -2) {
      if (socket_com[i].socket != -1)
	FD_SET(socket_com[i].socket, &readfds);
      i++;
    }
    select_s(s_info, &readfds, time);
  }
}
示例#2
0
文件: socktest.c 项目: basecq/q2dos
int sock_select (int sock)
{
  fd_set write_fd;
  fd_set read_fd;
  struct timeval timeout;

  FD_ZERO (&write_fd);
  FD_SET (sock, &write_fd);
  FD_ZERO (&read_fd);
  FD_SET (sock, &read_fd);
  timeout.tv_sec  = 1;
  timeout.tv_usec = 0;
  return select_s (sock+1, &read_fd, &write_fd, NULL, &timeout);
}