소켓 프로그래밍
-
[소켓프로그래밍] 5. 스레드, 멀티스레드, 스레드 제어윈도우 소켓 프로그래밍 2024. 8. 25. 17:12
이 게시글은 'TCP/IP 윈도우 소켓 프로그래밍 (김선우 저, 한빛아카데미)'를 공부한 내용을 기반으로 작성됨 직전 게시글에서 수행했던 TCP Server-Client 예제는 다음과 같은 문제를 갖는다. 여러 개의 Client가 Server에 접속하는 것은 가능하나, Server가 동시에 여러 Client에 서비스하는 것은 불가능하다. 예를 들어 두 개의 Client가 하나의 Server에 접속되어 있다면 먼저 접속한 Client가 Server에 전송한 메시지는 수신되지만, 늦게 접속한 Client가 전송한 메시지는 Server가 수신할 수 없다.이는 서버에 접속한 각 클라이언트들을 스레드를 이용하여 독립적으로 처리하여 해결한다. (멀티스레드)멀티스레드는 소켓 입출력 모델에 비해 비교적 쉽게 구현할 수..