>732
通信の遅延、サーバでかかる時間、クライアントで受け取った後の時間、輻輳といったものは含まれてない。
必要に応じて修正せよ。

#include<stdio.h>
#include<math.h>

/* assuming tcp/ip on ether */
#define PACKET_HEADER_SIZE (22+20+20)
#define PACKET_CONTENT_SIZE 1460
#define K * 1000
#define Mi * 1024*1024
#define BPS / 8
#define BYTE * 1
#define LINESPEED (64 K BPS)

int main( int narg, const char *args[] ){
 int megbytes;
 long datasize, packets, totalsize;
 double time;

 if( args[1] == 0 ) return;
 megbytes = atoi( args[1] );
 if( megbytes < 0 ) return;

 datasize = megbytes Mi BYTE;
 packets = ceil( datasize / ( double )PACKET_CONTENT_SIZE );
 totalsize = datasize + packets * PACKET_HEADER_SIZE;
 time = (double)totalsize / LINESPEED;

 printf( "%f seconds.\n", time );
}