반응형

standard input file descriptor를 이용


int STDIN = fileno(stdin);

int maxfd = (socket > STDIN)? socket: STDIN;

...

while (...) {

FD_SET(STDIN, &rdSet);

if (select(maxfd + 1, &rdSet, NULL, NULL, NULL) == -1) {printf("select()\n"); }

...

if (FD_ISSET(STDIN, &rdSet)) {

if (read(STDIN, cmd, 200) <= 0) continue ;

ParseCmd(rawSocket, cmd);

}

}

...

}


'develop > linux' 카테고리의 다른 글

Ubuntu에서 Oracle java 설치  (0) 2013.12.31
GCC에서 컴파일 시 문구 출력하기  (0) 2013.04.18
Raw 소켓  (0) 2012.12.28
find 명령어로 특정 시간내의 파일 찾기  (0) 2012.11.16
PostgreSQL Streaming Replication  (0) 2012.08.22

+ Recent posts