UDP 쓰레드 생성시
글쓴이: croae / 작성시간: 일, 2010/05/02 - 1:27오전
Pthread 생성시 TCP는 ACCEPT 되면 read, write 만하면 되니깐,
pthread_create(&thread,NULL, clnt_connection, (void *)clnt_sock) 이런식으로 쓰레드 함수 인자값만 주면 되는걸로 알고 있는데요
UDP는 recvfrom 하려면 UDP 주소와 주크기도 같이 받아오니깐 뒤에 인자가 두개더 필요한데 TCP 처럼 인자를 넣어버리면
안되네요 어찌하면 좋나요? UDP쓰레드 생성시 함수 인자값을 어떻게 줘야 하나요? 배우는 과정이라 많이 미숙합니다.
pthread_create(&thread2,NULL, udp_connection,&recv_udpsock);
Forums:
구조체를 하나
구조체를 하나 만드셔서 구조체 멤버에 소켓번호, 주소, 크기 등 데이터를 만드신 다음에
구조체 포인터를 넘기시면 됩니다.
-------------------------------------------------------------------------------
It's better to appear stupid and ask question than to be silent and remain stupid.
-------------------------------------------------------------------------------
It's better to appear stupid and ask question than to be silent and remain stupid.
댓글 달기