作者ami9897 (小新)
看板CSSE
标题[问题] 网路分流,公司考题
时间Mon Feb 28 14:28:50 2011
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
这是小弟在网路上看到的题目 是一间公司考新人用的
不知是否有人能解得出来? 小弟...完全不知如何下手
还请高人指点
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 111.240.89.139
1F:推 audreytang:maximumBy (compare `on` get_speed) . filter connect 03/06 10:36