#include #include #include #include #include #include "transfer.h" /* The procedures signal_block & msgDefineMessage are called from the libxfer library For this example code they can be noopos */ void signal_block () {} int msgDefineMessage (u_int id, u_int xclass, u_int level, char *source, char *body) { // printf("id=%d, class=%d, level=%d, source=%s: %s\n",id, xclass, level, source, body); return 0; } void Usage(char *progname) { printf("Usage\n%s -n [server] -p [port] -f [file_name] -d [format] -t [ticks] -s [buffersize] -v [v]\n",progname); printf("\tserver is the IP address or name of server (default localhost)\n"); printf("\tport is the base TCP port to use (default 10305)\n"); printf("\tfile_name defines a file to be read for data rather than using internally generated data (default no file - use internal data)\n"); printf("\tformat defines the data to be generated (default 0)\n"); printf("\tticks is the delay between sending data blocks in millisecs (default 0)\n"); printf("\tbuffersize is data block size in Kbytes (default 64)\n"); printf("\tv is the setting for the verbose flag (default 0)\n"); exit(1); } int main(int argc, char **argv) { int ID = 0; int Sync; int Ctime; char Buffer[(64*1024)+32]; int * BufferL; short * BufferS; char *TS_Server= (char*)"localhost"; int Port=10305; int InFlag =0; /* no file input by default */ int Format = 0; FILE *InStream; char *FileName= (char*)"f0.dat"; char fname[32]; unsigned int stream = 1; int DelayTicks=0; /* millisecs */ int NumBlocks=1; int verbose=0; int i, j; int BufferSize=64*1024; int num; int b; int rc; int Fblocks; struct timeval Time; int InitialTime; int diff; long StartTimeL, StartTimeS; long EndTimeL, EndTimeS; long rate; long long usecs; long long bytes; struct timespec time_request; if (argc >1) { for(i=1;i