1 / 10

Tutorial 8

Tutorial 8. Project 3 Prepared by Liu Ke. Architecture & Example. http://localhost:8080/192.168.1.100/10000/1024/tcp/media.mpg. Media Player (real player, wmp ). Port = 10000 Folder = c:media. HTTP Server. Streaming Client. Streaming Server. Port = 8080 Folder = c:temp.

Télécharger la présentation

Tutorial 8

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Tutorial 8 Project 3 Prepared by Liu Ke

  2. Architecture & Example http://localhost:8080/192.168.1.100/10000/1024/tcp/media.mpg Media Player (real player, wmp) Port = 10000 Folder = c:\media HTTP Server Streaming Client Streaming Server Port = 8080 Folder = c:\temp Wait few seconds for buffering media.mpg media.mpg Server IP = 192.168.1.100 Server Port = 10000 Packet size = 1024 Protocol = tcp Filename = media.mpg Project 3

  3. HTTP Server • Listen on the 8080 port and accept the incoming HTTP connection • HTTP request is initiated at localhost • HTTP server uses While loop to accept the HTTP requests • For each HTTP request, create a thread to handle the request and HTTP server is accepting other HTTP requests

  4. HTTP Server • We call the thread function handling one HTTP request httpRequestHandler • It analyzes the http request, split the line into tokens, packet size, streaming server IP address, streaming server port number, protocol, media file, etc • If the media file is in the cache folder (already finish downloading), write the file to the media player, you need to write the MIME HTTP header before you write the data

  5. HTTP Server • We call the thread function handling one HTTP request httpRequestHandler • If the media file is not in the cache folder, pass these parameters to the streaming client • Create a thread for streaming client to communicate with the streaming server • httpRequestHandler waits for the incoming data and write those data to the media player • Check the file whether can read

  6. Streaming Client • Streaming client communicates with Streaming server • It is similar to the C++ version NetProbe • You need to write a Java version NetProbe client but without calculating the statistics and displaying them

  7. Program Flow Diagram Cache Folder StreamingClient HTTP Server 8 3 2 5 1 HTTPRequestHandler 6 7 4 Media Player StreamingServer 7

  8. Program Flow • HTTP Request is sent out from media player and received at HTTP Server • Pass the request to the httpRequestHandler • Check whether the media file is existed or not, if not, analyze the HTTP request and go to 5, if it exists, go to 4 • httpRuestHandler fetches the data packet from the cache folder and replies media player, write media file • Pass the parameters to the streaming client

  9. Program flow • Send the request to the streaming server • Receiving data packets from the streaming server • Write the data packets to the file created in the cache folder and go to 4

  10. Notes • Need a synchronization on the caches file but it is optional, read thread and write thread access the file but only one thread can access the file • Reply a MIME header before write the data • Need to handle some error situation, etc., timeout, wrong file, etc.

More Related