Archived
3
0

en chantier ne regarde pas ça pique

This commit is contained in:
lapupe 2016-09-18 01:03:37 +02:00
parent a1612c5ca9
commit 7d237ad87c
2 changed files with 15 additions and 4 deletions

View File

@ -1,5 +1,5 @@
#include "tcpdserver.h"
#include "../lib.communication.h"
#include "../lib/communication.h"
#include <sys/types.h>
#include <sys/socket.h>
@ -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;
}

View File

@ -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);