Chapter 5 & 6 UDP 서버/클라이언트 u-Network Design Lab 5
Thread Synchronization Need Synchronization. Why ? Share variable Int Balance = 100 Thread 2 Thread 1 u-Network Design Write Write Balance = Balance + 10; Balance = Balance +40;
Question 1 Modify ExCriticalSection example to use Event as thread synchronization mechanism. Important Functions CreateEvent(…) BOOL SetEvent (HANDLE hEvent) Refer Text Book pg. 182-188 u-Network Design
Sample Output Question 1 Without Thread Synchronization With Thread Synchronization u-Network Design
UDP server/client structure socket() bind() recvfrom() sendto() closesocket() UDP server UDP client network u-Network Design
TCP vs UDP u-Network Design
TCP vs UDP TCP Frame UDP Frame Heavyweight Lightweight u-Network Design TCP Frame UDP Frame Heavyweight Lightweight
Question 2 Modify FileReceiver.cpp & FileSender.cpp to UDP base. [UDP Server] Client IP 192.168.94.109 is connected. [UDP Server] Client IP 192.168.94.109 is Sending file[test] 19 bytes. [UDP Server] Client IP 127.0.0.1 is connected. [UDP Server] Client IP 127.0.0.1 is Sending file[a.hwp] 123 bytes. [UDP Server] Client IP 192.168.94.109 sent file[test] successfully. [UDP Server] Client IP 127.0.0.1 sent file[a.hwp] successfully. u-Network Design
Question 3 Modify Lab4-Q3 to UDP base Write a simple TCP User Authentication Program with multi-threading using _beginthreadex() and _endthreadex(). Client sends username to server. Server replies the member’s status back to client. Modify Lab4-Q3 to UDP base Do you still need multi-threading ? u-Network Design
Sample Output Question 3 Enter your username: dongseo …..Checking your status……. ====================== Username: dongseo Status: Member Enter your username: thread Username: thread Your status: Admin Enter your username: udesign Username : udesign Your status: Non-member u-Network Design
Thank you u-Network Design