Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 5 멀티스레드 u-Network Design Lab 4.

Similar presentations


Presentation on theme: "Chapter 5 멀티스레드 u-Network Design Lab 4."— Presentation transcript:

1 Chapter 5 멀티스레드 u-Network Design Lab 4

2 What is Multi-threading
A process is a running program. You can run more than one process at a time. BUT they run as processes in their own separate memory space. How to run a program in the same memory space as another running process? Threads are a way for a program to split itself into two or more simultaneously (or pseudo- simultaneously) running tasks These threads share resource and global variables. u-Network Design

3 u-Network Design Single Threaded Multi Threaded

4 Question 1 Write a TCP Server Program to convert all received message from Client to UPPERCASE. Send the UPPERCASE message back to client. Modify Lab 3-Question 1 TCP Server Program to accept Multiple Clients. u-Network Design

5 Sample Output Question 1
Client 1 Client 2 u-Network Design Client 3

6 Question 2 Modify FileReceiver.cpp to allow multiple clients to send file at the same time. [TCP Server] Client IP is connected. [TCP Server] Client IP is Sending file[test] 19 bytes. [TCP Server] Client IP is connected. [TCP Server] Client IP is Sending file[a.hwp] 123 bytes. [TCP Server] Client IP sent file[test] successfully. [TCP Server] Client IP sent file[a.hwp] successfully. u-Network Design

7 Question 3 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. u-Network Design

8 Sample Output Question 2
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

9 Thank you u-Network Design


Download ppt "Chapter 5 멀티스레드 u-Network Design Lab 4."

Similar presentations


Ads by Google