Obsolete
/
libipc-old
Archived
3
0
Fork 0

en chantier ne regarde pas ça pique

more_to_read
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 "tcpdserver.h"
#include "../lib.communication.h" #include "../lib/communication.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
@ -162,7 +162,7 @@ void * listen_thread(void * pdata) {
return NULL; return NULL;
}*/ }*/
pthread_t senPid; pthread_t sendPid;
int ret = pthread_create( &sendPid, NULL, &send_thread, (void *) pda); int ret = pthread_create( &sendPid, NULL, &send_thread, (void *) pda);
if (ret) { if (ret) {
perror("pthread_create()"); perror("pthread_create()");
@ -178,7 +178,7 @@ void * listen_thread(void * pdata) {
} }
} }
pthread_join(listenPid, NULL); pthread_join(sendPid, NULL);
return NULL; return NULL;
} }

View File

@ -14,12 +14,23 @@ typedef struct {
int initConnection (); int initConnection ();
void endConnection (int sock, int csock); void endConnection (int sock, int csock);
void printClientAddr (struct sockaddr_in *csin); void printClientAddr (struct sockaddr_in *csin);
void write_message(int sock, const char *buffer); void write_message(int sock, const char *buffer);
int read_message(int sock, 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); void parseServiceVersion(char * buf, char ** service, int *version);
//create 2 pathnames such as : pid-index-version-in/out
void inOutPathCreate(char ** pathname, int version); void inOutPathCreate(char ** pathname, int version);
//create a fifo file
int fifo_create (char * path); int fifo_create (char * path);