[问题] 网络分流,公司考题

楼主: ami9897 (小新)   2011-02-28 14:28:50
4. Suppose server S want to download real time video from one of existing
media servers A, B, C, D. However the server S still doesn't know which media
server is available and can provide the highest speed transfer.
Please write a simple code to make the server S chooses the fastest server
using below function:
a. int get_speed(ServerID);
This function is used to get the transfer speed from Server[ServerID] to
server S on HTTP protocol. The return value of this function is integer
value. For example: get_speed(A) return 15, it means the transfer speed is 15
Kbps.
b. bool connect(server);
This function is to check the availability of the media server using RMTP
(Real Time Message Protocol). This function will return true if the media
server have the video source that can be streamed by server S. For example:
connect(A) return true, it means server S can stream video from server A.
Hint:
get_speed(serverID) function only check the transfer speed of the media
server using normal HTTP. It doesn't guarantee the media server is available.
Example: Media Server A may provide the highest transfer speed, however there
is no video source available in media server A. So in this case, server B may
connect to other server
这是小弟在网络上看到的题目 是一间公司考新人用的
不知是否有人能解得出来? 小弟...完全不知如何下手
还请高人指点
作者: audreytang (凤)   2011-03-06 10:36:00
maximumBy (compare `on` get_speed) . filter connect

Links booklink

Contact Us: admin [ a t ] ucptt.com