diff --git a/network/ocli b/network/ocli deleted file mode 100755 index 221967ae3dc7c99b79ae188e1431db3d814d07ad..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9160 zcmcIp4{Vg>8GrAth4SyNu;MBxTpVnbtS4Z_isHU&IrvHnA{0fme7*L*(v$YCyZcT- zKJcnWNcwema%Lujfqk~#VyNHS+kdB69$e)sjx zm?e8J_dW0Pd!OfhpZ9tHzwZ-~<~3fAM{w|py9IGWQ#A?MUm-5cmaM|+#WbOb1!BIK z0;C*&O{NgFV@$8AteI9QIUi^l{`FoPsP}3z!t@3k7EIYfqEy~Q&{Wi>*Jjx)Qz3#9 zAU(3R(l1%iHW^`hP}wo4DC-eRdNoR~M(HsfRfaL;`cd8J-=gws@oM0R*NBMK@;gCE zmcqt!R*d3r%#JiY*;X5y?dcYc7D}RsRTEv@=E#Tf~p@=#fn?Hxx0;fER<+G>+KBELK(9RvytSdx1*|F2Kgt;qji7qRdNQ+)Gl}e^WM>3HxJ1k)s zX)D^X)9C2hX>>;8-6EbaEu$BrqBj*!Se>HB>`5bwbXUfTB_B@ObKukSs1RKaocaof zUI(tGESa>+fvYK5;(ZQWO{o&s`#-AC2g=Q9L80#-vC7AO2w3lbwc@l)&VO>ZZGuQ{ zaSOhIg&JbScTxKIyE%l#>xic&86TB=1M$=p<0Fz^Njx>d_;JZEC!SnCJ|y`i#FNX% z2PJ*=-?72t1t*3{PpLFcy))SPJdpEGKkFa6lSpMWyALRAyDgEU6 z@93UU{mrWxD8EF4`u?-l17((hY!FYFbW*;}AF_Bae_eZBl{K%PsdseSbR zRm0^FuomP^sM>NOh*cEwxzX0~Jx~cO6ys@7%44(s+ ztjI>jmW>RQe~JdoMh*>>eH}kkD5ewEju_OB>4zhu zFVXOS1%G6CW~>4!oo6DWUU5QO2%R@R2cM0c)d%)d;d=iFx~9+%ZyDA5PnD4is5^~$ zpq7ms>ECxGm#I3@OlA0~G+AyHVrL@HQ#txTA8_&dO11#bPz#lS0ggKget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WCU* z+|drQqN1$F^s-C;pwd663}ibw8`fj~GeijE`qT9Rg(FJQEw9`mW$2T`pRlFGI0Eah zcVHA{eWvsb!DTx|&vE%Is1jYQ%#ZuNQ@>YjSc7UD)4ggf{#+lP*JykeD}OME1cZ85 zqPu)ss`%Fj>*~GQq(r*SY$=NSgjEzT%kP_=nfb7b9xf_BMesUQC_h#3`cjBj2wpb| z@o9qBgF<|Ie&1Y(&&bc;h4@U&$C?w8ai5r#f0uG5`Y@yLJX(kcL~y3&gk;=@!NT*N zGtno|yLdixB=~TX&hwN5MnCwP;Q6NzuflxN=7eP2C+6ZEsTh7;{+`*XPVp!qs zbL9QNJq|m0d~`~DvOf>2eE3`nR)!zp>nYMM!@!Hxi^?g6|54^MTU>Ru`&$y9><7R_ z^Ld{VV2`^$dBx_LlluX$#&qC z=s)g$VgfJrUbIKzlgHPSCFFln0zX~?f3*buP6_;C34AsjLiKWwiv_@o`KK26Y;Uy~ zbd8slgky)n^9JvKnt&JcPn*OsFU`pAWh6&#=5}9PKTUKb=b`A9s5l zRr%2UKLvT01p12-`MeA~NP@2LW(oO!mB6n8C%?JvDZ{!KbmdL#0^oCSV&Z)|i!72j za}L^(veH%tH%9O)cw<2^Y1jZzKn`MBBSfK^Fn`qp2`Vc`Ly0 zubRehsPuBGa&kT5PRP{Ruf7uiDcKLZg_!eIw=l(i|1HEOz4N-0o%R>L0HYbxNuw*8 zh@qNB(>*Xf7Ec(Nv>BUtdv<4+cO1DI9!bFewyO&tpxt`7Nl|k0G1`9nb_uO}#Mq>I oX=8UZokka>=kh`+^;}*E8V1^o`wBHCckP0vl-)x;#24!S7ir&syZ`_I diff --git a/network/oser b/network/oser deleted file mode 100755 index 4ccfe1e8552aec7988de0f0cb0e449e90b5aa572..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13496 zcmeHOZ){uD6~DIICZ(<8mJC7*%^OgbR*IXJPy!5iPU`lhN=s=|U_kof*e{8xV_Wt! zO*^FonIf#LEFa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qlPwT}4fZ-ZN`n2v%h=%5&%$)50+Yg1f#*jX(D-VeVHwk5GKgkh20Oh!55l`#Z zs8DDT`u6qq@;HkI^gotzZC?J~vI!OyHeStBFNCWXFibGVO}&VR>$4tTRZ#Z%3RhNj9JkfBKW!VG)C zrce87L~OjYzmU8b7R0jSLZAGf6#H^g=>N1VX=KQM1fR6&Q~VLdCAE^Ep!WJ-w&^P? zWG<_(Fdk6L#qR60wvFps;abYECcCHxI;XC;%pGMV7i*e4eH z0ShbH`H*X^S}-2I0Nhof-@g{}_V%xYhPv3oe*X^OtHA#l)r5)Gu-gHbIAXo*<@myJ zvY*?r$|9Ep+y`&f)Gs7)kjpQeUn357o_D}sa=`Nr_#YkcPaN@32|X9x4><6g&mA{!^C4qfd1COPTm23#{n+_E}>yt`pQ9mrKfT{@lAlEpY846 z2)Jakjclibokuyoa3AS&kk=h>7EbADJp&O=VF(1?(XmJE>fGC{sw|?Vv;ho8N~!vg z3V}s&EzK%Gsv1eC1F=M3D5gdrzA3GSGQ$ksypu6a*CPHccies}Sgs(X;u(PPMz6wK zdg>4}&Hy5rp`k;dV&YUhIt5vJ%OD;HMnalG~c)v%3IVUOx^mu zU4fmQ9Ux^Y;UUpX-QIOyd!S3bZ`-!L!EUuX(B2h9b3AG~oX+r8GqtmOr#kPV?wuXz zpzcs#Ok;QeVMJ5&SZ-OSh-!?ZRyBS;A*|Q}yyrz*jhOIx0CkPHZ!5+F$gPkO7jDIP zV3-wJ5D0EBHr#&^olplu@d(_m+Ib(`MkE?nGieBCGkFSqD`M7dwlxS@7cR1f zr`zOIIK~ljJX9TH-K`=b@ZAa;k@Qwf-SN1(M~vu>SSX!_;cUdoTjek;--@UzbT17n b?01?4mR{$<_BKWC01V}~;>JG!Sh4>AQ5b?h diff --git a/network/overhead_client.c b/network/overhead_client.c index d882440..8d0cc41 100644 --- a/network/overhead_client.c +++ b/network/overhead_client.c @@ -39,11 +39,11 @@ int main(int argc, char*argv[]) int i; int protonum = proto_entry->p_proto; for(i=1;i<=BACKLOG;i++){ - getTime(starttime); //Open an socket end-point for this TCP Server if((socket_fd = socket(AF_INET, SOCK_STREAM, protonum))<0){ handle_error("Socket Error"); } + getTime(starttime); if(connect(socket_fd, (struct sockaddr*)&server, sizeof(server))<0){ handle_error("Connection Error"); } @@ -60,7 +60,7 @@ int main(int argc, char*argv[]) so_linger.l_onoff = 1; so_linger.l_linger = 0; - /*z = setsockopt(socket_fd, + z = setsockopt(socket_fd, SOL_SOCKET, SO_LINGER, &so_linger, @@ -68,10 +68,9 @@ int main(int argc, char*argv[]) if ( z ) perror("setsockopt(2)"); - */ + getTime(starttime); - shutdown(socket_fd, SHUT_RDWR); - //close(socket_fd); + close(socket_fd); getTime(endtime); //Calculate connection overhead server side diff --git a/network/peak_client.c b/network/peak_client.c index 3527121..e07a9a5 100644 --- a/network/peak_client.c +++ b/network/peak_client.c @@ -9,11 +9,32 @@ //Macro definitions #define handle_error(msg) \ do { perror(msg); exit(1);} while(0); -#define BACKLOG 50 +#define BUFFER_SIZE 1 * MB +#define MB 1024 * 1024 +#define STRIDE_SIZE 64 +#define BACKLOG 64 //buff size/stride size + +//A random string generator of given length +char* generate_string(int length) +{ + //Random number seed + srand((unsigned int) ctime(0)); + char * buff; + buff=(char *)malloc(sizeof(char)*(length+1)); + int i; + for(i=0;i< length;i++){ + buff[i] = rand() % rand() % (126 - 33 + 1) + 33; + } + buff[i] = '\0'; + return buff; +} + int main(int argc, char*argv[]) { int socket_fd, rc; - float start_delta = 0, close_delta = 0; + char buff[BUFFER_SIZE]; + char *msg; + float delta = 0, min =9999; if(argc<2){ handle_error(":tcp_client "); } @@ -27,7 +48,7 @@ int main(int argc, char*argv[]) struct sockaddr_in server; memset(&server, 0, sizeof(struct sockaddr)); server.sin_family = AF_INET; - server.sin_port = htons(8000); + server.sin_port = htons(9); rc= inet_pton(AF_INET, argv[1], &server.sin_addr); if(rc == -1){ @@ -38,32 +59,28 @@ int main(int argc, char*argv[]) int addr_size = sizeof(struct sockaddr); int i; int protonum = proto_entry->p_proto; + + //Open an socket end-point for this TCP Server + if((socket_fd = socket(AF_INET, SOCK_STREAM, protonum))<0){ + handle_error("Socket Error"); + } + if(connect(socket_fd, (struct sockaddr*)&server, sizeof(server))<0){ + handle_error("Connection Error"); + } + msg = generate_string(BUFFER_SIZE); for(i=1;i<=BACKLOG;i++){ getTime(starttime); - //Open an socket end-point for this TCP Server - if((socket_fd = socket(AF_INET, SOCK_STREAM, protonum))<0){ - handle_error("Socket Error"); - } - if(connect(socket_fd, (struct sockaddr*)&server, sizeof(server))<0){ - handle_error("Connection Error"); + if(send(socket_fd, msg, strlen(msg), 0) <0){ + handle_error("Send Error"); } - /*The end calculated here will miss time taken for ACK K+1 - from the client. And so we have to one way delay - measured using another experiment*/ - getTime(endtime); - - //Calculate connection overhead client - start_delta+=diff(endtime,starttime); - - getTime(starttime); - close(socket_fd); getTime(endtime); - - //Calculate connection overhead server side - close_delta+=diff(endtime,starttime); + delta+=(diff(endtime, starttime)); + if(delta < min) min = delta; + printf("Single Tput %fBps\n",(BUFFER_SIZE/ diff(endtime, starttime))); } - printf("Connection Setup =%f us\n", (start_delta + RTT/2 * BACKLOG)/BACKLOG); - printf("Connection Teardown =%f us\n", (close_delta + RTT/2 * BACKLOG)/BACKLOG); + + close(socket_fd); + printf("GoodPut = %f Bps, MaxTput= %f Bps", (BUFFER_SIZE)*(BACKLOG/delta), (BUFFER_SIZE/min)); return 0; } diff --git a/network/peak_server.c b/network/peak_server.c deleted file mode 100644 index 87de305..0000000 --- a/network/peak_server.c +++ /dev/null @@ -1,90 +0,0 @@ -#include "../rasperf.h" -#include -#include -#include -#include -#include -#include -#include -#include - -//Macro definitions -#define handle_error(msg) \ - do { perror(msg); exit(1);} while(0); -#define LISTEN_BACKLOG 50 - -int main(int argc, char*argv[]) -{ - int socket_fd, rc; - float setup_delta, close_delta; - if(argc<1){ - handle_error(":tcp_server"); - } - //Retrieve the protocol number mapping - //from /etc/protocols file - struct protoent *proto_entry; - proto_entry = getprotobyname("tcp"); - - //Open an socket end-point for this TCP Server - socket_fd = socket(AF_INET, SOCK_STREAM, proto_entry->p_proto); - if(socket_fd == -1){ - handle_error("Socket descriptor creation failed"); - } - - //My address information to bind to - struct sockaddr_in sock_addr; - memset(&sock_addr, 0, sizeof(struct sockaddr)); - sock_addr.sin_family = AF_INET; - sock_addr.sin_addr.s_addr = htonl(INADDR_ANY); - sock_addr.sin_port = htons(8000); - - - rc = bind(socket_fd, (struct sockaddr*)&sock_addr, sizeof(sock_addr)); - if(rc == -1){ - handle_error("Bind failure"); - } - rc = listen(socket_fd, LISTEN_BACKLOG); - if(rc == -1){ - handle_error(" Listen Error"); - } - - time starttime, endtime; - - //accept incoming connections - int connfd, i, pid, addr_size = sizeof(struct sockaddr); - for(i=1;i<=1000;i++) - { - //getTime(starttime); - printf("Accept Connection\n"); - //waitpid(WAIT_ANY, NULL, WNOHANG); - connfd = accept(socket_fd, (struct sockaddr *)NULL, NULL); - /*The end calculated here would have missed SYN time - from the client. And so we have to add one - packet worth round trip time in the overhead*/ - //getTime(endtime); - if( connfd == -1){ - handle_error("Accept failed"); - } - //setup_delta+=diff(endtime,starttime); - if(pid = fork() == 0){ - close(socket_fd); - close(connfd); - printf("Connection %d closed in Child\n",i); - //close_delta=diff(endtime, starttime); - //printf("Connection Termination %f", close_delta + RTT); - exit(0); - } - close(connfd); - } - //getTime(starttime); - close(socket_fd); - //getTime(endtime); - - //Calculate connection overhead server side - //setup_delta+=diff(endtime,starttime); - //printf("Connection Overhead:Setup =%f us\n", (setup_delta+ RTT*600)/600); - - return 0; -} - - diff --git a/network/rand b/network/rand deleted file mode 100755 index ebd6e6eb4e94a6316ade822f6b4d268c202fb4b5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8852 zcmeHMeQaCR6~DIg)i1~C$`&YV-dHQ8NHJ|FCFNs0Cvp1Hr5|e@C?DyI6FZ5)u_ODr zv`m9ap=DNE)<3GLRGL8h1F;Ql42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&h495VaDZFUEbKb49L>~`$pGQ;=a)> zEtXforO;qJ70*PiIE4ncCve~CLg`H~%Cc#52%&_hX6IJu#1bhpmyIJ(#b#5W)D?4S zUHID|sDfwW2twuM)w8*2x4B()p|)f+n??UIO$3MkCW;z&sFIk;e@4(hTw2|~0VfMW AtN;K2 diff --git a/network/random_str.c b/network/random_str.c deleted file mode 100644 index 7d1f452..0000000 --- a/network/random_str.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include -#include -char* generate_string(int length) -{ - //Random number seed - srand((unsigned int) ctime(0)); - char * buff; - buff=(char *)malloc(sizeof(char)*length); - int i; - for(i=0;i< length-1;i++){ - buff[i] = rand() % rand() % (126 - 33 + 1) + 33; - } - buff[i] = '\0'; - return buff; -} -int main() -{ - char *buf; - buf = generate_string(5); - printf("String of 5: %s, size: %lu\n", buf, strlen(buf)); - free(buf); - - buf = generate_string(40); - printf("String of 40: %s, size: %lu\n", buf, strlen(buf)); - free(buf); - - buf = generate_string(80); - printf("String of 80: %s,, size: %lu\n", buf, strlen(buf)); - free(buf); - - return 0; -} diff --git a/network/rtt_client.c b/network/rtt_client.c index 8554910..99918ca 100644 --- a/network/rtt_client.c +++ b/network/rtt_client.c @@ -9,9 +9,9 @@ //Macro definitions #define handle_error(msg) \ do { perror(msg); exit(1);} while(0); -#define BUFFER_SIZE 2048 -#define STRIDE_SIZE 64 -#define BACKLOG 32 //buff size/stride size +#define BUFFER_SIZE 1024 * 1024 +#define STRIDE_SIZE 512 +#define BACKLOG 5 //buff size/stride size //A random string generator of given length char* generate_string(int length) @@ -47,7 +47,7 @@ int main(int argc, char*argv[]) struct sockaddr_in server; memset(&server, 0, sizeof(struct sockaddr)); server.sin_family = AF_INET; - server.sin_port = htons(8000); + server.sin_port = htons(7); rc= inet_pton(AF_INET, argv[1], &server.sin_addr); if(rc == -1){ diff --git a/network/rtt_server.c b/network/rtt_server.c deleted file mode 100644 index 35a987c..0000000 --- a/network/rtt_server.c +++ /dev/null @@ -1,83 +0,0 @@ -#include "../rasperf.h" -#include -#include -#include -#include -#include -#include -#include -#include - -//Macro definitions -#define handle_error(msg) \ - do { perror(msg); exit(1);} while(0); -#define LISTEN_BACKLOG 100 -#define BUFFER_SIZE 2048 -#define STRIDE_SIZE 64 -#define BACKLOG 32 - -int main(int argc, char*argv[]) -{ - int socket_fd, rc; - char buff[BUFFER_SIZE]; - float setup_delta, close_delta; - if(argc<1){ - handle_error(":tcp_server"); - } - //Retrieve the protocol number mapping - //from /etc/protocols file - struct protoent *proto_entry; - proto_entry = getprotobyname("tcp"); - - //Open an socket end-point for this TCP Server - socket_fd = socket(AF_INET, SOCK_STREAM, proto_entry->p_proto); - if(socket_fd == -1){ - handle_error("Socket descriptor creation failed"); - } - - //My address information to bind to - struct sockaddr_in sock_addr; - memset(&sock_addr, 0, sizeof(struct sockaddr)); - sock_addr.sin_family = AF_INET; - sock_addr.sin_addr.s_addr = htonl(INADDR_ANY); - sock_addr.sin_port = htons(8000); - - - rc = bind(socket_fd, (struct sockaddr*)&sock_addr, sizeof(sock_addr)); - if(rc == -1){ - handle_error("Bind failure"); - } - rc = listen(socket_fd, LISTEN_BACKLOG); - if(rc == -1){ - handle_error(" Listen Error"); - } - - time starttime, endtime; - //accept incoming connections - int connfd, i, pid, addr_size = sizeof(struct sockaddr); - printf("Accept Connection\n"); - connfd = accept(socket_fd, (struct sockaddr *)NULL, NULL); - if( connfd == -1){ - handle_error("Accept failed"); - } - for(i=1;i<=BACKLOG;i++) - { - printf("%d\n",i); - getTime(starttime); - if(recv(connfd, buff,i* STRIDE_SIZE, 0) != i* STRIDE_SIZE){ - printf("String :%s, strlen:%d, stride:%d\n", buff, strlen(buff), i*STRIDE_SIZE); - handle_error("Receive Error/ Data Done"); - } - if(send(connfd, buff,i * STRIDE_SIZE, 0)<0){ - handle_error("Send Error"); - } - getTime(endtime); - } - - close(socket_fd); - close(connfd); - printf("Connection %d closed in Child\n",i); - return 0; -} - - diff --git a/network/standby_servers/peak_server.c b/network/standby_servers/peak_server.c new file mode 100644 index 0000000..2136a55 --- /dev/null +++ b/network/standby_servers/peak_server.c @@ -0,0 +1,80 @@ +#include "../rasperf.h" +#include +#include +#include +#include +#include +#include +#include +#include + +//Macro definitions +#define handle_error(msg) \ + do { perror(msg); exit(1);} while(0); +#define LISTEN_BACKLOG 100 +#define BUFFER_SIZE 5 * MB +#define MB 1024*1024 +#define STRIDE_SIZE 64 +#define BACKLOG 64 + +int main(int argc, char*argv[]) +{ + int socket_fd, rc; + char buff[BUFFER_SIZE]; + float setup_delta, close_delta; + if(argc<1){ + handle_error(":tcp_server"); + } + //Retrieve the protocol number mapping + //from /etc/protocols file + struct protoent *proto_entry; + proto_entry = getprotobyname("tcp"); + + //Open an socket end-point for this TCP Server + socket_fd = socket(AF_INET, SOCK_STREAM, proto_entry->p_proto); + if(socket_fd == -1){ + handle_error("Socket descriptor creation failed"); + } + + //My address information to bind to + struct sockaddr_in sock_addr; + memset(&sock_addr, 0, sizeof(struct sockaddr)); + sock_addr.sin_family = AF_INET; + sock_addr.sin_addr.s_addr = htonl(INADDR_ANY); + sock_addr.sin_port = htons(8000); + + + rc = bind(socket_fd, (struct sockaddr*)&sock_addr, sizeof(sock_addr)); + if(rc == -1){ + handle_error("Bind failure"); + } + rc = listen(socket_fd, LISTEN_BACKLOG); + if(rc == -1){ + handle_error(" Listen Error"); + } + + time starttime, endtime; + //accept incoming connections + int connfd, i, pid, addr_size = sizeof(struct sockaddr); + printf("Accept Connection\n"); + connfd = accept(socket_fd, (struct sockaddr *)NULL, NULL); + if( connfd == -1){ + handle_error("Accept failed"); + } + + getTime(starttime); + for(i=1;i<=BACKLOG;i++) + { + if(recv(connfd, buff,BUFFER_SIZE, 0) == -1){ + handle_error("Receive Error/ Data Done"); + } + } + getTime(endtime); + + close(socket_fd); + close(connfd); + printf("Data Receided:%d MB, Time:%f s \n",i*BUFFER_SIZE, diff(endtime, starttime)); + return 0; +} + + diff --git a/network/standby_servers/random_str.c b/network/standby_servers/random_str.c new file mode 100644 index 0000000..7d1f452 --- /dev/null +++ b/network/standby_servers/random_str.c @@ -0,0 +1,33 @@ +#include +#include +#include +char* generate_string(int length) +{ + //Random number seed + srand((unsigned int) ctime(0)); + char * buff; + buff=(char *)malloc(sizeof(char)*length); + int i; + for(i=0;i< length-1;i++){ + buff[i] = rand() % rand() % (126 - 33 + 1) + 33; + } + buff[i] = '\0'; + return buff; +} +int main() +{ + char *buf; + buf = generate_string(5); + printf("String of 5: %s, size: %lu\n", buf, strlen(buf)); + free(buf); + + buf = generate_string(40); + printf("String of 40: %s, size: %lu\n", buf, strlen(buf)); + free(buf); + + buf = generate_string(80); + printf("String of 80: %s,, size: %lu\n", buf, strlen(buf)); + free(buf); + + return 0; +} diff --git a/network/standby_servers/rtt_server.c b/network/standby_servers/rtt_server.c new file mode 100644 index 0000000..1e4124d --- /dev/null +++ b/network/standby_servers/rtt_server.c @@ -0,0 +1,83 @@ +#include "../rasperf.h" +#include +#include +#include +#include +#include +#include +#include +#include + +//Macro definitions +#define handle_error(msg) \ + do { perror(msg); exit(1);} while(0); +#define LISTEN_BACKLOG 100 +#define BUFFER_SIZE 1024 * 1024 +#define STRIDE_SIZE 64 +#define BACKLOG 128 + +int main(int argc, char*argv[]) +{ + int socket_fd, rc; + char buff[BUFFER_SIZE]; + float setup_delta, close_delta; + if(argc<1){ + handle_error(":tcp_server"); + } + //Retrieve the protocol number mapping + //from /etc/protocols file + struct protoent *proto_entry; + proto_entry = getprotobyname("tcp"); + + //Open an socket end-point for this TCP Server + socket_fd = socket(AF_INET, SOCK_STREAM, proto_entry->p_proto); + if(socket_fd == -1){ + handle_error("Socket descriptor creation failed"); + } + + //My address information to bind to + struct sockaddr_in sock_addr; + memset(&sock_addr, 0, sizeof(struct sockaddr)); + sock_addr.sin_family = AF_INET; + sock_addr.sin_addr.s_addr = htonl(INADDR_ANY); + sock_addr.sin_port = htons(8000); + + + rc = bind(socket_fd, (struct sockaddr*)&sock_addr, sizeof(sock_addr)); + if(rc == -1){ + handle_error("Bind failure"); + } + rc = listen(socket_fd, LISTEN_BACKLOG); + if(rc == -1){ + handle_error(" Listen Error"); + } + + time starttime, endtime; + //accept incoming connections + int connfd, i, pid, addr_size = sizeof(struct sockaddr); + printf("Accept Connection\n"); + connfd = accept(socket_fd, (struct sockaddr *)NULL, NULL); + if( connfd == -1){ + handle_error("Accept failed"); + } + for(i=1;i<=BACKLOG;i++) + { + printf("%d\n",i); + getTime(starttime); + if(recv(connfd, buff,i* STRIDE_SIZE, 0) != i* STRIDE_SIZE){ + printf("String :%s, strlen:%d, stride:%d\n", buff, strlen(buff), i*STRIDE_SIZE); + handle_error("Receive Error/ Data Done"); + } + if(send(connfd, buff,i * STRIDE_SIZE, 0)<0){ + handle_error("Send Error"); + } + getTime(endtime); + } + + close(socket_fd); + close(connfd); + printf("Connection %d closed in Child\n",i); + return 0; +} + + diff --git a/network/standby_servers/tcp_rtt_client.bul b/network/standby_servers/tcp_rtt_client.bul new file mode 100644 index 0000000..82bf516 --- /dev/null +++ b/network/standby_servers/tcp_rtt_client.bul @@ -0,0 +1,76 @@ +#include "../rasperf.h" +#include +#include +#include +#include +#include +#include +#include +//Macro definitions +#define handle_error(msg) \ + do { perror(msg); exit(1);} while(0); +#define BACKLOG 1 +int main(int argc, char*argv[]) +{ + int socket_fd, rc; + float start_delta = 0, close_delta = 0; + if(argc<2){ + handle_error(":tcp_client "); + } + //Retrieve the protocol number mapping + //from /etc/protocols file + struct protoent *proto_entry; + proto_entry = getprotobyname("tcp"); + + + //My address information to bind to + struct sockaddr_in server; + memset(&server, 0, sizeof(struct sockaddr)); + server.sin_family = AF_INET; + server.sin_port = htons(8000); + + rc= inet_pton(AF_INET, argv[1], &server.sin_addr); + if(rc == -1){ + handle_error("Address Error"); + } + time starttime, endtime; + //accept incoming connections + int addr_size = sizeof(struct sockaddr); + int i; + int protonum = proto_entry->p_proto; + for(i=1;i<=BACKLOG;i++){ + getTime(starttime); + //Open an socket end-point for this TCP Server + if((socket_fd = socket(AF_INET, SOCK_STREAM, protonum))<0){ + handle_error("Socket descriptor creation failed"); + } + if((connect(socket_fd, (struct sockaddr*)&server, sizeof(server)))<0){ + handle_error("Connect failed"); + } + /*The end calculated here will miss time taken for ACK K+1 + from the client. And so we have to one way delay + measured using another experiment*/ + getTime(endtime); + + //Calculate connection overhead client + start_delta+=diff(endtime,starttime); + printf("EndTime: %f usec\n", endtime.tv_sec + endtime.tv_usec*1e6); + printf("Start time:%f usec\n", starttime.tv_sec +starttime.tv_usec*1e6); + printf("Setup:%f\n",diff(endtime,starttime) + 25); + + getTime(starttime); + sleep(1); + close(socket_fd); + getTime(endtime); + printf("Endtime %f usec\n", endtime.tv_sec + endtime.tv_usec*1e6); + printf("Start time:%f usec\n", starttime.tv_sec +starttime.tv_usec*1e6); + printf("TearDown:%f\n",diff(endtime,starttime) + 25); + //Calculate connection overhead server side + close_delta+=diff(endtime,starttime); + } + printf("Connection Setup =%f us\n", (start_delta + RTT/2 * BACKLOG)/BACKLOG); + printf("Connection Teardown =%f us\n", (close_delta + RTT/2 * BACKLOG)/BACKLOG); + return 0; +} + + diff --git a/network/tcp_rtt_client.bul b/network/tcp_rtt_client.bul deleted file mode 100644 index 82bf516..0000000 --- a/network/tcp_rtt_client.bul +++ /dev/null @@ -1,76 +0,0 @@ -#include "../rasperf.h" -#include -#include -#include -#include -#include -#include -#include -//Macro definitions -#define handle_error(msg) \ - do { perror(msg); exit(1);} while(0); -#define BACKLOG 1 -int main(int argc, char*argv[]) -{ - int socket_fd, rc; - float start_delta = 0, close_delta = 0; - if(argc<2){ - handle_error(":tcp_client "); - } - //Retrieve the protocol number mapping - //from /etc/protocols file - struct protoent *proto_entry; - proto_entry = getprotobyname("tcp"); - - - //My address information to bind to - struct sockaddr_in server; - memset(&server, 0, sizeof(struct sockaddr)); - server.sin_family = AF_INET; - server.sin_port = htons(8000); - - rc= inet_pton(AF_INET, argv[1], &server.sin_addr); - if(rc == -1){ - handle_error("Address Error"); - } - time starttime, endtime; - //accept incoming connections - int addr_size = sizeof(struct sockaddr); - int i; - int protonum = proto_entry->p_proto; - for(i=1;i<=BACKLOG;i++){ - getTime(starttime); - //Open an socket end-point for this TCP Server - if((socket_fd = socket(AF_INET, SOCK_STREAM, protonum))<0){ - handle_error("Socket descriptor creation failed"); - } - if((connect(socket_fd, (struct sockaddr*)&server, sizeof(server)))<0){ - handle_error("Connect failed"); - } - /*The end calculated here will miss time taken for ACK K+1 - from the client. And so we have to one way delay - measured using another experiment*/ - getTime(endtime); - - //Calculate connection overhead client - start_delta+=diff(endtime,starttime); - printf("EndTime: %f usec\n", endtime.tv_sec + endtime.tv_usec*1e6); - printf("Start time:%f usec\n", starttime.tv_sec +starttime.tv_usec*1e6); - printf("Setup:%f\n",diff(endtime,starttime) + 25); - - getTime(starttime); - sleep(1); - close(socket_fd); - getTime(endtime); - printf("Endtime %f usec\n", endtime.tv_sec + endtime.tv_usec*1e6); - printf("Start time:%f usec\n", starttime.tv_sec +starttime.tv_usec*1e6); - printf("TearDown:%f\n",diff(endtime,starttime) + 25); - //Calculate connection overhead server side - close_delta+=diff(endtime,starttime); - } - printf("Connection Setup =%f us\n", (start_delta + RTT/2 * BACKLOG)/BACKLOG); - printf("Connection Teardown =%f us\n", (close_delta + RTT/2 * BACKLOG)/BACKLOG); - return 0; -} - - diff --git a/rasperf.h b/rasperf.h index 8a57704..b18327a 100644 --- a/rasperf.h +++ b/rasperf.h @@ -3,8 +3,8 @@ #define NULL '\0' #define __RASPERF_H__ #define RTT 35 //in MicroSec -#define PI 0 -#define x86 1 +#define PI 1 +#define x86 0 #define CPU_CYCLES 900 #define MHz 1e6 #if defined(PI) && PI @@ -18,7 +18,7 @@ "mrc p15, 0, %0, c9, c14, 0":\ "=r" (var)); #define diff(end, begin) \ - (end - begin)/ CPU_CYCLES}; + (end - begin) #endif #if defined(x86) && x86 #define time struct timeval