From 7d237ad87cd5ab163e9f972c773f794b71b98f4e Mon Sep 17 00:00:00 2001 From: lapupe Date: Sun, 18 Sep 2016 01:03:37 +0200 Subject: [PATCH] =?UTF-8?q?en=20chantier=20ne=20regarde=20pas=20=C3=A7a=20?= =?UTF-8?q?pique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- remote/tcpdserver.c | 6 +++--- remote/tcpdserver.h | 13 ++++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/remote/tcpdserver.c b/remote/tcpdserver.c index 61e3b46..f6369f3 100644 --- a/remote/tcpdserver.c +++ b/remote/tcpdserver.c @@ -1,5 +1,5 @@ #include "tcpdserver.h" -#include "../lib.communication.h" +#include "../lib/communication.h" #include #include @@ -162,7 +162,7 @@ void * listen_thread(void * pdata) { return NULL; }*/ - pthread_t senPid; + pthread_t sendPid; int ret = pthread_create( &sendPid, NULL, &send_thread, (void *) pda); if (ret) { perror("pthread_create()"); @@ -178,7 +178,7 @@ void * listen_thread(void * pdata) { } } - pthread_join(listenPid, NULL); + pthread_join(sendPid, NULL); return NULL; } diff --git a/remote/tcpdserver.h b/remote/tcpdserver.h index 025412a..e47c338 100644 --- a/remote/tcpdserver.h +++ b/remote/tcpdserver.h @@ -14,12 +14,23 @@ typedef struct { int initConnection (); void endConnection (int sock, int csock); + void printClientAddr (struct sockaddr_in *csin); + void write_message(int sock, const char *buffer); int read_message(int sock, char *buffer); -void * listen_thread(void * p_data); + +//2 threads for listen and send data +void * listen_thread(void * pdata); +void * send_thread(void * pdata); + +//parse the first message from client in service and version void parseServiceVersion(char * buf, char ** service, int *version); + +//create 2 pathnames such as : pid-index-version-in/out void inOutPathCreate(char ** pathname, int version); + +//create a fifo file int fifo_create (char * path);