190 likes | 481 Views
IERG4180 Tutorial 5. Jim. Outline. Assignment 2 – NetProbe Client-Server Edition S pecifications Implementations Marking scheme Submission requirements. Specifications. Extend NetProbe of your assignment 1 into:
E N D
Outline • Assignment 2 – NetProbe Client-Server Edition • Specifications • Implementations • Marking scheme • Submission requirements
Specifications • Extend NetProbe of your assignment 1 into: • Server Mode and Client Mode(you can keep the hostInfo here, but we won’t count this part) • Your source code has to be compilable and executable in both Linux and Windows • Client side • Send requests(rate, packet size, etc.) to server, and then receive response from server • Display statistics • Server side • Wait for new incoming requests • When there is one, use another thread to handle the request • Display connection information
Communication Flow Client Server Request as metadata: Rate, protocol, etc. Send Request Send Respond ...
Client Side Program Flow Display thread Process thread Client Server Show Stat. WSAStartup() Send Request Socket() Send Respond connect() ... send() recv() closesocket() WSACleanup() For Windows TCP case. Similar for Linux case. Similar for UDP case.
Server Side Program Flow Thread 2 Thread 3 Thread 1 WSAStartup() Show Info. TCP Connection UDP Connection Socket() bind() listen() accept() process For Windows TCP case. Similar for Linux case. Similar for UDP case.
Server Side Program Flow Client Server New Thread Send Request recv() Send Respond send() ... closesocket() accept() process For Windows TCP case. Similar for Linux case. Similar for UDP case.
Server Side Program Flow Thread 3 Show Info. New Thread recv() A class/data structure Record elapsed time, sent packet send() closesocket() accept() Count the number of TCP Connections with Mutex process For Windows TCP case. Similar for Linux case. Similar for UDP case.
Program Flow • You can have your own program design, as long as it fulfills the specification • Ask tutors if you are not sure
Multi-thread • A Portable Threading Library: http://tinycthread.bitsnbites.eu/ • tinycthread.h, tinycthread.c (you may have to rename as .cpp) • More on lecture notes and the following reference: http://tinycthread.bitsnbites.eu/doc/tinycthread_8h.html
Reminders • Your thread function must follow: • intyour_funciton(void *arg) • Declare your thread function as static if it is a class member function (refer to lecture 4 p.52-54) • Check you are using Multithreaded Run-time Library
Reminders • You might have to link –pthread for Linux. In Eclipse:
Portability • Refer to tutorial4 slide19-20
es_Timer • http://course.ie.cuhk.edu.hk/~ierg4180/project/es_TIMER.zip • Only require es_TIMER.h • add '-lrt' to linker to link with the RT timer lib • For Eclipse, go to Project > Properties to set
Marking Scheme • http://course.ie.cuhk.edu.hk/~ierg4180/project/IERG4180_Assignment2_marking_scheme.pdf • Remark: Documentation is important • Later if you work as a developer… • Your effort will be wasted if your colleagues don’t understand how to proceed with your code • And now if I don’t know what to do with your source files, I can’t grade your assignment! • So, take it seriously
Submission requirements • You must use Centos 6.4 as your Linux platform • I assume you use VS2010 for Windows; Eclipse for Centos 6.4 • If you want to use VS2012, you can • If you want to use vim and compile with gcc in Linux, you can • What to submit: • Submit your source code, together with a clear enough documentation on how to use your code (starting from creating new project, adding your codes to the project, making any additional settings (e.g. the es_TIMER), to compiling your code (if you use any IDE); if you use gcc, tell me how to make your executable • Submit your experimental results as well • Late submission policy • Same as assignment 1