Title: IEG4180 Tutorial 9 Project 4 Discussion
1IEG4180 Tutorial 9 Project 4 Discussion IOCP
(Acknowledgement some materials in this tutorial
are adopted from previous works by Shing and
Zero.)
2Outline
- Project 4
- What if IOCP not available?
3Architecture Example
http//localhost8080/192.168.1.100/10000/1024/tcp
/192.168.1.101/10000/1024/udp/media.mpg
Port 10000 Folder c\media
Media Player
Streaming Server
Same program written in Java
Streaming Client
HTTP Server
Port 8080 Folder c\temp
media.mpg
Wait few seconds for buffering
media.mpg
Port 10000 Folder c\media
Server IP 192.168.1.100, 192.168.1.101 Server
Port 10000 Packet size 1024 Protocol tcp,
udp Filename media.mpg
Streaming Server
media.mpg
4Components
- Streaming Client and HTTP Server
- Support different media players (RealPlayer,
Windows Media Player) - Parameters input (listen port and caching folder)
(GUI or console) - Support different media types (.mpg, .rm, .mp3)
- Return appropriate HTTP reply to media player if
streaming cannot start - Accept special URL from media players to specify
streaming behaviour from specified Streaming
Server (protocol, packet size, transfer rate)
5Components (cont.)
- Streaming Server
- Supporting at least two streaming clients at the
same time - Startup parameters (listen port and shared
folder) (GUI or console) - Support NetProbe Client in Project 3
- Directory Server
- Use of Java Servlet is not a must
- List all files monitored by all Streaming Servers
- Generate special URL for media player to request
for specifying various parameters
6Streaming
- Startup latency lt 10s
- Completion of streaming of whole media for TCP
- Smoothness
- Streaming media file via TCP
- Streaming media file via UDP
- Flow control in case of UDP
- Packet loss recovery is optional
- Streaming is stopped when media player is closed
7Flow Control
- It's up to you to design the flow control for use
in your implementation. - Explain flow control mechanism clearly in
documentation - For example
- Fixed sending rate
- Client controls the sending rate in real time
- Make sure the sending rate is sufficient
- The playing speed is different for different
media files - Fixed sending rate maybe not suitable for some
media files. - Media player would be forced to pause or even stop
8Error Handling
- Different type of errors
- File Not Found
- Wrong streaming server IP address or port
- Return HTTP reply to media player
- 404 File Not Found
- 200 OK
9What if IOCP not available?
- Not every servers are running on Windows
- Mainly supported by NT-kernel
- Linux?
10Common Single thread models
- Single client
- Blocking I/O
- Most portion of time is waiting for further
action - Concurrent clients
- Polling (with Non-Blocking I/O)
- Expense of looping through many useless function
calls - Select-based I/O (with (Non-)Blocking I/O)
- Maintenance of fd_set
11Common Multi-threaded models
- Mixing with single thread I/O models
- One thread per client (e.g. Blocking I/O)
- Single thread for concurrent clients (e.g.
Polling, Select-based I/O) - Threads for specific stages (Computation, I/O)
- Single client may be served by multiple thread
12OS specific I/O models
- Microsoft Windows
- Message-Driven I/O
- Alertable I/O
- Linux
- poll()
- AIO
- epoll
- BSD
- kqueue