UNIX Network Programming Volume 1, Third Edition [Electronic resources] : The Sockets Networking API نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

UNIX Network Programming Volume 1, Third Edition [Electronic resources] : The Sockets Networking API - نسخه متنی

Addison Wesley

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید










Exercises


26.1

Compare the descriptor usage in a server using fork versus a server using a thread, assuming 100 clients are being serviced at the same time.

26.2

What happens in Figure 26.3 if the thread does not close the connected socket when str_echo returns?

26.3

In Figures 5.5 and 6.13, we print "server terminated prematurely" when we expect an echoed line from the server but receive an EOF instead (recall Section 5.12). Modify Figure 26.2 to print this message too, when appropriate.

Figures 26.11 and 26.12 so that they can compile on a system that does not support threads.

Figure 26.3, build that program and start the server. Then, build the TCP echo client from Figure 6.13 that works in a batch mode correctly. Find a large text file on your system and start the client three times in a batch mode, reading from the large text file and writing its output to a temporary file. If possible, run the clients on a different host from the server. If the three clients terminate correctly (often they hang), look at their temporary output files and compare them to the input file.

Now build a version of the server using the correct readline function from Section 26.5. Rerun the test with three clients; all three clients should now work. You should also put a printf in the readline_destructor function, the readline_once function, and in the call to malloc in readline. This shows that the key is created only one time, but the memory is allocated for every thread, and that the destructor function is called for every thread.


/ 450