From fa6265f3d0088ef6b65cc1a8e2e497b22c6858b3 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Wed, 8 Feb 2017 11:44:10 +0100 Subject: [PATCH] TCP socket/branch [FUNC] --- client | Bin 17888 -> 0 bytes client.c | 10 +++---- client.o | Bin 6752 -> 6752 bytes lib.c | 83 +++++++++++++++++++++++++++---------------------------- lib.h | 7 +++-- lib.o | Bin 10712 -> 11760 bytes server | Bin 17976 -> 0 bytes server.c | 35 ++++++++++++++++------- server.o | Bin 6680 -> 6968 bytes 9 files changed, 76 insertions(+), 59 deletions(-) delete mode 100755 client delete mode 100755 server diff --git a/client b/client deleted file mode 100755 index c2d77653fbb2cabfe58e45a3c2059fb3dbaa01f0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17888 zcmeHPdvIITnLoOcEX7vjN1WjB%H;$Y0nTG%W+ z&u8bbGLY@~Q+!^TQ}C2jt)Nq?u>#ug*P;nRi{|AS1@rl9hWAlaKrUYQjzK2M+u zGNy9^$&s&BXLA&A6VE6(CjA(fP{|QWa`jTKUdkzWNIIsVsvp&j{yL?;PR$F9a4!MY z&Yx3|cqy$tnh8@rUdvHHFV84=gCH{nmE30_M}GdjsY)`gllDr*<+!Y$f)Zto@mTlL z=EiuqAs$O)2O0)imNqPH_N0@Z#k}66pLnlYvw>Suanym4&s06?15`fni*H{y`!^4L zaH9Oa3-@-64XqD6Ig4b~AF_XUS_{sa8Mv31phrv4uP8x3s|0;h3HoUz=ns{kf2Rcf zkrMPBCFs8dUB{m}r9qe}KDU&hUtEIzr4sawCFqF~^z%y4zgU7!zR%=;MF~1XKMhg0 zT*}hP(9MwyiwwjvtT&TP#Q8JL`Xi}SGQ|Rc7&tDyG>}e*f{7m1pUtE}OlN|jn**WV zn*%+;Se&S#-e8KQBEfh(8DjmZSR&KI(wS5|l3?AjM40tO`a=DKtWPj>-x5hB!5-S& zlS=lnXe85{OlP_W6T!X+3&oS^2unv2;Y<>?$X7C$$^`m?u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*QTzd24qo3 z5)1HRN#;op_GNkpVnuJ^)jacXv;u zSIz*vVJK0U5EWB_kWl%XLSTa#Y&nGBLo!3^L7^+29yAm4U{a!cn4r<(8FIly6k(Pq zzay%Oy1P@6&8h^Sp+;05F`Hqk{)b5P-i%j=!uyw6hpO+E)w#7&PQ1o+9uPV!#`MmU zTCb|_f^|t(K>Z#oya^ejyjs_0q{8zRql9MpcF=LPFsba{qj@>!J(8gO$5t^ViqL_Ua5IAt!?b>(r2JQW3f_z|I(t{RTAw?~VWhPJ@Nc}yw(?(+8Lex`RVA<1@f)SQs;9EA zUl0L(V9#_78SQ zLz|?1C7{+@3Vy>Rul5;^&k_>KUnOtG?=#7(_dI?H7-g?e=Qbo|SCPJpjM0B}zvKuV zsv$`?1cIlz{yzkb8r{f*;Neoz%i4QBu8Ov)&)zQb4F=ieaZ6foPTZ>@~-YQN-Q zt&n(#3Ju9@{~46I@ke8bl3G`)@Ab|6X8d``RN_y`tNoWcxiw+tH{&lumRwZwYM(~` zJLO-6EcIO_ul94)|EEAFrj%6wR`yjtxCdoM`)c3kl-xp5{9Fkh3Rm#2CV8fB60Eua zV*(VON>0I3C^6bs>$Ndmh$ugm0wt&LkB}jns=rzf9MT1c1Oma+tj`MLWPeeCLu8bE zvx!c;loWJHc|o0e+RhRAO;aSEQ*w%YMhW?_lrL8eCk4#%7nYDuTqp#dHVK$ewxopo z;){fQ)HHt0@^n{*Xy*8R>k~r$SP6Nhho%YDc0xitx6>gw(rU#h&_diL%5jqkUUaAY i;aVgou=7A&ia*tV)b9rs&t!jO8CS!eHx-)PVgCa=oseDt diff --git a/client.c b/client.c index 48ced06..85de852 100644 --- a/client.c +++ b/client.c @@ -8,8 +8,8 @@ int main(int argc, char* argv[]){ =========================================================*/ /* (1) Socket information */ struct sockaddr_in server_addr; // server info - int sock; // socket - int port; // chosen port + int sock, // socket + port; // chosen port char hostname[24]; // chosen hostname /* (2) Misc. information */ @@ -57,7 +57,7 @@ int main(int argc, char* argv[]){ /* (1-) Manage error */ if( sock == -1 ){ - perror("erreur création socket"); + perror("erreur connection server"); exit(1); } @@ -65,7 +65,7 @@ int main(int argc, char* argv[]){ /* [4] Send message =========================================================*/ /* (1) Send message to server */ - bytes = xsend(sock, to_send, &server_addr); + bytes = xwrite(sock, to_send); /* (2) Check if send succesfully */ if( bytes == -1 ){ @@ -80,7 +80,7 @@ int main(int argc, char* argv[]){ /* [5] Wait for response =========================================================*/ /* (1) Wait for response */ - bytes = xlisten(sock, &server_addr, to_recv, BUFSIZE); + bytes = xread(sock, to_recv, BUFSIZE); /* (2) Check if received successfully (and consistently) */ if( bytes == -1 ){ diff --git a/client.o b/client.o index 8cae374e0f00de274827739fd608cd71fd86caeb..9239c855247bc8df75ae23dd008dd1463e69ce9a 100644 GIT binary patch delta 552 zcmaE0^1x)m1jd&WCk8T3pZM5bO9V5e{Yo8s*3*(8lD<%f{@- z#KX=pSy5DSvVa)NW*#mVpdph3x$iTEPA=pYXN(4uiIWp~(v-`KGD}h!DvDAQQy7wS z@{3a$;^T`;5|gvzlQXj8(-Jdt7&gD+5o2Q9Fqx5GTyh^H*wGAJKnmo3Q7HfL$X2KY`?`$(0iJjP;XuO4u`P;RMChW&ue9M#iGajAHTt?s}D5 delta 554 zcmaE0^1x)m1jct0Ck8UknfTa(F?q5KVj_w zDlF2BK+1tNlaVQcY4S%-vB?M7&U2Kf&tJ&l%rSZM40Z*k$=f+qg(H}NCOYy7v@tpJ zvM~oU@vw7DRuq+-EFi|RnTN{-XvpM1?)!`(lMA`U8Dqd?(&R**H09#dycC9toXp~q z)I5gdoc!WchWPm6lEmcf_~eZ2__V~#oXxLz#F!YjOlIU4mpsG>vdfS47CMWFoS zlP~g#dtQX{K#mau;y?c(;5M2rO(_2cG*Bx^G`m=FYYM` zl|{Ep6-`$NRF^)IdStsSCo2kwGX`z86mVw+hEk(wInxYCNDGK*z?cDI28@}L8^z3l zk-Jl@p7H)lqJB{s|;kPOg-&XRMpNQ^KBUGbbpfHVa4^FftZTW)zbL E04^Yx`Tzg` diff --git a/lib.c b/lib.c index 2566189..b31696b 100644 --- a/lib.c +++ b/lib.c @@ -32,8 +32,8 @@ int xbind(const int port){ /* [1] Create xsocket =========================================================*/ /* (1) Create UPD xsocket */ - xsocket = socket(AF_INET, SOCK_STREAM, 0); DEBUG&& debug("xbind", "creating server socket"); + xsocket = socket(AF_INET, SOCK_STREAM, 0); /* (r2-) Manage error */ if( xsocket == -1 ){ @@ -58,8 +58,8 @@ int xbind(const int port){ /* [3] Bind to port =========================================================*/ /* (1) Bind and return -1 if error */ - bound = bind(xsocket, (struct sockaddr*)&addr, sizeof(addr)); DEBUG&& debug("xbind", "binding socket to port"); + bound = bind(xsocket, (struct sockaddr*)&addr, sizeof(addr)); /* (2) Manage error */ if( bound == -1 ){ @@ -72,7 +72,8 @@ int xbind(const int port){ /* [4] Mark socket so it will listen for incoming co. =========================================================*/ - DEBUG&& debug("xbind", "make socket listen for co"); + DEBUG&& debug("xbind", "listen for client"); + if( listen(xsocket, 1) < 0 ){ DEBUG&& printf("error\n"); return -1; @@ -92,20 +93,22 @@ int xbind(const int port){ -int xlisten(const int xsocket, struct sockaddr_in* client, char* buffer, int bufsize){ +int xlisten(const int xsocket, struct sockaddr_in* client){ /* [1] Initialization =========================================================*/ unsigned int sock_len; - int clientsock, bytes; - char buf[bufsize] = {'\0'}; + int clientsock; /* [2] Wait for client =========================================================*/ - clientsock = accept(xsocket, (struct sockaddr*) client, &sock_len); + /* (1) Wait for incoming client connection */ DEBUG&& debug("xlisten", "listening for client"); + clientsock = accept(xsocket, (struct sockaddr*) client, &sock_len); + /* (2) Manage errors */ + if( clientsock == -1 ){ DEBUG&& printf("error\n"); return -1; @@ -113,26 +116,7 @@ int xlisten(const int xsocket, struct sockaddr_in* client, char* buffer, int buf DEBUG&& printf("done\n"); - - /* [3] Receive client data - =========================================================*/ - // while there is chunks to read - do{ - - /* (1) Receive buffer */ - bytes = recv(clientsock, buf, bufsize); - - /* (2) Copy to target */ - buffer = realloc(buffer, (strlen(buffer)+strlen(buf)) * sizeof(char ); - strcat(buffer, buf); - - }while( bytes > 0 ); - - - - - - + return clientsock; } @@ -146,15 +130,15 @@ int xconnect(const char* hostname, const int port, struct sockaddr_in* serv){ /* [0] Initialization =========================================================*/ - int xsocket, bound; + int xsocket, bound, connected; struct hostent *host; // data found by lookup /* [1] Create xsocket =========================================================*/ /* (1) Create UPD xsocket */ - xsocket = socket(AF_INET, SOCK_STREAM, 0); DEBUG&& debug("xconnect", "creating client socket"); + xsocket = socket(AF_INET, SOCK_STREAM, 0); /* (r2-) Manage error */ if( xsocket == -1 ){ @@ -168,8 +152,8 @@ int xconnect(const char* hostname, const int port, struct sockaddr_in* serv){ /* [2] Get information by hostname =========================================================*/ /* (1) Process */ - host = gethostbyname(hostname); DEBUG&& debug("xconnect", "fetch info by hostname"); + host = gethostbyname(hostname); /* (2) Manage error */ if( host == NULL ){ @@ -184,8 +168,8 @@ int xconnect(const char* hostname, const int port, struct sockaddr_in* serv){ /* [3] Set server useful information from fetched info =========================================================*/ /* (1) Reset values */ - bzero(serv, sizeof(struct sockaddr_in)); DEBUG&& debug("xconnect", "building server info"); + bzero(serv, sizeof(struct sockaddr_in)); /* (2) Set server info (ipv4, port) */ serv->sin_family = AF_INET; @@ -197,6 +181,22 @@ int xconnect(const char* hostname, const int port, struct sockaddr_in* serv){ DEBUG&& printf("built\n"); + /* [4] Connect to server + =========================================================*/ + /* (1) Try to connect to given server */ + DEBUG&& debug("xconnect", "connecting to server"); + connected = connect(xsocket, (struct sockaddr*) serv, sizeof(*serv)); + + /* (2) Manage error */ + if( connected == -1 ){ + DEBUG&& printf("error\n"); + return -1; + } + + DEBUG&& printf("done\n"); + + + // return socket return xsocket; } @@ -208,17 +208,16 @@ int xconnect(const char* hostname, const int port, struct sockaddr_in* serv){ -int xlisten(const int xsocket, struct sockaddr_in *client, char* buffer, int bufsize){ +int xread(const int xsocket, char* buffer, int bufsize){ /* [1] Wait for message through xsocket =========================================================*/ - /* (1) Useful data + memory allocation */ - socklen_t sock_len = sizeof(struct sockaddr_in); + /* (1) Memory allocation */ buffer = (char*) realloc(buffer, sizeof(char) * bufsize ); /* (2) Listen */ - DEBUG&& debug("xlisten", "waiting for data"); - int read = listen(xsocket, 1); + DEBUG&& debug("xread", "waiting for data"); + int read = recv(xsocket, buffer, bufsize, 0); /* (3) Manage error */ if( read == -1 ){ @@ -228,7 +227,7 @@ int xlisten(const int xsocket, struct sockaddr_in *client, char* buffer, int buf DEBUG&& printf("received\n"); - printf("[xlisten:received] '%s'\n", buffer); + DEBUG&& printf("[xread:received] '%s'\n", buffer); /* [2] Return number of read characters @@ -241,16 +240,16 @@ int xlisten(const int xsocket, struct sockaddr_in *client, char* buffer, int buf -int xsend(const int xsocket, char* buffer, struct sockaddr_in* target){ +int xwrite(const int xsocket, char* buffer){ /* [1] Send buffer (message) to target =========================================================*/ /* (1) Useful data */ - size_t addr_len = sizeof(struct sockaddr_in); + unsigned int addr_len = sizeof(struct sockaddr_in); /* (2) Send data */ - DEBUG&& debug("xsend", "sending data"); - int sent = sendto(xsocket, buffer, strlen(buffer)+1, 0, (struct sockaddr*) target, addr_len); + DEBUG&& debug("xwrite", "sending data"); + int sent = send(xsocket, buffer, strlen(buffer), 0); /* (3) Manage error */ if( sent == -1 ){ @@ -261,7 +260,7 @@ int xsend(const int xsocket, char* buffer, struct sockaddr_in* target){ DEBUG&& printf("sent\n"); - printf("[xsend:sent] '%s'\n", buffer); + DEBUG&& printf("[xwrite:sent] '%s'\n", buffer); /* [2] Return number of sent characters diff --git a/lib.h b/lib.h index cca2bff..ff7423c 100644 --- a/lib.h +++ b/lib.h @@ -31,7 +31,10 @@ int debug(const char* tag, const char* msg); int xbind(const int port); + int xlisten(const int xsocket, struct sockaddr_in* client); + int xconnect(const char* hostname, const int port, struct sockaddr_in* serv); - int xlisten(const int xsocket, struct sockaddr_in *client, char* buffer, int bufsize); - int xsend(const int xsocket, char* buffer, struct sockaddr_in* target); + + int xread(const int xsocket, char* buffer, int bufsize); + int xwrite(const int xsocket, char* buffer); #endif diff --git a/lib.o b/lib.o index aa27e385f10ad14b8f72de55e2b2fe85565767e6..7cdc95f12e149773fcb631756a20e849c99e1799 100644 GIT binary patch literal 11760 zcmcIq3vg7|c|QA)v>+q|LbixWym<)AO|+7XP;5L9VX^T#fFXd!xP+1RaaX%W+EsS% z8p(<5P~oIo<$>a9a3(mdTgRD99%M2}OYDqIW5-Nii4%7k%{ZAb6UjD)X-J@r>{8SJ zKj;6ij(&EVnRa>x-Fwb=zW;g7J?GrJJQUsWLBG$ZxcJl-wb)`*sc*M0*86m|PqnDk zY9Lmg-y55{&>kyK&c@267h}`W7h~l!uOa96v*qWY4Y+CF{9Ji<>U3KrR!`St?`pF@*iF)|SUI{dHMwxLv{u+Tbrs6FSC9*TmIKc;F{b6yXKJwDuco6HR{rg2iX>gu=%Q)U z7XC~}7oI|G8Yand^vcxam8+%egjwy+`FjO=twJ3h>3aC|L}fLrg&J_=@9n(7K%Gs+ zrh{$m;9U$-)O}i5ihX9_Vr+WnS%^AT{;}u#<*CWb)qKC!=w;Bbkcw?sq3yUeI-#B; zT`*-{E0^YC<$+mYz4Aa_oSM8?Z6N;$MqLCgbi#CdjVB_89D`}0s!WStKwAEwwpl$> zJe4q;(`WQNnOmGEHdg*uFRF6%tjHttN;o&Z4~bIV?D(H% zcDo1+vH*tU(?1=(a*c0iq6^+bq?PDA8F{m=#4yeOfBs;MTn@Aq4~E-{Dp_#iZZd9!O(RV8;qRin!80h-Wa?S0uQB!ekkhJGqLeR) z9bAf3@txQO+MC??Fc2mH^v}eaMvIHBzE#Nd)uFI|<|Cx5)z)<@7{TH@@igdKt*fmV z67Y@mIwPG~(i&;jOxV{3?PQ42f#GrNt-6iz7r z%#dk0#*Y*v7)=@dM{NB^y;x3o`j42r>^J(47;F2eWvs=F{)dhJArqNyE$K*^)+bT7 ze_Ru-2HmY3*Ij=w)B)7w%Y#q^24b2pK2*txB!x@pNHxHT05; z*lb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OqcwR2ebL&gK7~5w1--snFVpiMrHe$Cxf=C5 z!NHNlsH*=Svy;o-BLU?y{9DCQi?MlCvOEGpm za{Sa~^wl~Yd(u1=QE+w1Kr(tGMDO60|7ty7OBEum5?SWlfs#}Ct>Du;eMPHve~;Af zk@`meCCq5OL@`zRhYFpXbx7)~b{gZS@Xt#9cCM8@moOpq)j0;zCmmz_J`apyBE>WN z4X30ap2%_%`KnJT5PJR0zC^K*+G7Z~TF0sUO9p+lf3c@T=qrB(mGxiI_Z#%pbK*X! z|0E4=T~hTb=pRwg`>)Qe^vcD6Y=#o&eU%|lcu4B2{!`D*eNz8w#gIzI_WX-MUwz-N zzWd)M^;Bkz|D-`*?ZepQL6-*&@i*504D_)Z!0#cdL#mA=|1QvXi_y?Ldi#ri_FrDE$@#PO_9#UWS4y3y!$ftPpvh9z@wFOP}=^F;YoL{Swu2 z(vDH~l05pKzCXQ@LhfrRFKQ(^T?+3BxtAFNlFpy>qOoKb@e*mPH BoR$Cp diff --git a/server.c b/server.c index f40639f..e90e20a 100644 --- a/server.c +++ b/server.c @@ -12,7 +12,7 @@ int main(int argc, char* argv[]){ char client_ip[20]; int port; // chosen port // Socket - int sock; + int listensock, datasock; /* (2) Misc. information */ @@ -54,36 +54,50 @@ int main(int argc, char* argv[]){ /* [3] Create socket =========================================================*/ /* (1) Create socket */ - sock = xbind(port); + listensock = xbind(port); /* (1-) Manage error */ - if( sock == -1 ){ + if( listensock == -1 ){ perror("erreur création socket"); exit(1); } - /* [4] Wait for client message + /* [4] Wait for client =========================================================*/ - /* (1) Listen to data */ - bytes = xlisten(sock, &addr_client, to_recv, BUFSIZE); + /* (1) Listen to incoming connection */ + datasock = xlisten(listensock, &addr_client); + /* (2) Manage error */ + if( datasock == -1 ){ + perror("erreur connection client"); + exit(1); + } + + + + /* [5] Wait for data + =========================================================*/ + /* (1) wait/read data */ + bytes = xread(datasock, to_recv, BUFSIZE); /* (2) Manage error */ if( bytes == -1 ){ - perror("erreur réception paquet"); + perror("erreur reception paquet"); exit(1); } + // Get client ip inet_ntop(AF_INET, &(addr_client.sin_addr), client_ip, 20); printf("*** received '%s' (%d bytes) from %s:%d\n", to_recv, bytes, client_ip, ntohs(addr_client.sin_port)); + - /* [5] Send response + /* [6] Send response =========================================================*/ /* (1) Send response */ - bytes = xsend(sock, to_send, &addr_client); + bytes = xwrite(datasock, to_send); /* (2) Manage error */ if( bytes == -1 ){ @@ -94,7 +108,8 @@ int main(int argc, char* argv[]){ /* [6] Close socket =========================================================*/ - close(sock); + close(datasock); + close(listensock); return 0; } diff --git a/server.o b/server.o index 4e516f91caad5aac914871a0fc7808e6aaea9807..868c4a5b2661239c80ee2a7ed2b193172cb8daad 100644 GIT binary patch delta 1284 zcmZ9LTWAwe5QcX)nr3U-B;9OJmLgQVv?v&()lkGnkV=vL#sLw1XhqS!C@CpeMd{_mE24;(2NjD7`XCZTs-WmO-BVb0;LPUy-#;^Fv%BZ( zhF6@a6@MwYh3)bW5QI=R*dOX1wS}@m==8QcIzY*dS3y4aE&>~IH7xh$d+vP}X!Hb! zx(^Ng>u`^--IO#!8|c4i?bB>7 z?6mEUWFqNgw6!4HRsjgOL8_5sB5k;)+<8J=TV}QF673~6oN%j!eksHTd?}rTW}KMS z2<=!bC9scWTy5W4*O}5HyM=f{%Y+k|WV=99OIqmMpNeNRA=;KqYeG1j&P1ZE;b=>1 zcuyqWCKN{Ozd?<$zmEo+Oz8UaPmd0KR!-Cd2C5k7F}zex)?F}AkAV(wy_9M*>H0|* zi|YozvD;174PKznLEr;+Icnlg?zFOF(O?&uuIbYegI;CO=W~5}ay{>}(BL;tuEQ}p zvjK}VhgdF)7@V{5uVWcZqR&a75!X4xY9F1&!mnQhHixZ)IOZhkFjs>n+Jr?)@A9*3 zHPLRI<09%6PFqYghMOtf&S|fSw&PKk7f$0K^<3nh8z#>qoNy7ij=x=Ab&#{SCeH(0 zQ$gSqHdlDnbDY_Ezv+8?j+ZKk^oFY|@u*Djbww@gLXZiZLsj;wpLp$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