diff --git a/Threads/Page.html b/Threads/Page.html
new file mode 100644
index 0000000..3d538cb
--- /dev/null
+++ b/Threads/Page.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Interface Tangible
+
+
+
+
+
diff --git a/Threads/threadSocket.c b/Threads/threadSocket.c
index b69a24e..859c4b7 100644
--- a/Threads/threadSocket.c
+++ b/Threads/threadSocket.c
@@ -10,24 +10,27 @@ void* reponseConnexion(void* sock)
{
printf("Connected\n");
- char buffer[]= "HTTP/1.1 200 OK\nServer: Serveur fait maison\nContent-Type: text/html; charset=UTF-8\nConnection: Keep-alive\n\nHey !
";
-
+ char buff_rec[BUFF_SIZE];
+ char buffer[]="HTTP/1.1 200 OK\r\nServer: Serveur fait maison\r\nContent-Type: text/html; charset=UTF-8\r\nConnection: Keep-alive\r\n\r\nPOST /Page.html HTTP/1.1\r\n\r\n";
+
+
FILE* sockdial_stream = fdopen(*((int*)(sock)), "a+");
printf("Sock : %d // Stream : %p \n", *((int*)(sock)), sockdial_stream);
+ fgets(buff_rec, BUFF_SIZE, sockdial_stream);
fprintf(sockdial_stream, "%s", buffer);
- while(strcmp(buffer, "EXIT\n")!=0)
- {
+ //while(strcmp(buffer, "EXIT\n")!=0)
+ //{
printf("WAIT\n");
- fgets(buffer, BUFF_SIZE, sockdial_stream);
+ // fgets(buff_rec, BUFF_SIZE, sockdial_stream);
- printf("Le message reçu : %s", buffer);
+ printf("Le message reçu : %s", buff_rec);
fprintf(sockdial_stream, "Ceci est une réponse du serveur TCP.\n");
- }
+ //}
strcpy(buffer, "START");
printf("Fin de la connexion\n");
diff --git a/bin/test b/bin/test
index cd9c123..aeebf71 100755
Binary files a/bin/test and b/bin/test differ
diff --git a/bin/test.c b/bin/test.c
index b87e7d3..d2447b4 100644
--- a/bin/test.c
+++ b/bin/test.c
@@ -1,10 +1,27 @@
#include
#include
+#include
#include
#include
+#include
#include "libnet.h"
+int sock_fd;
+
+struct sigaction action;
+
+void handler(int sig)
+{
+ if(sig==SIGINT)
+ {
+ printf("\nINTERRUPTION SOCKET : %d\n\n", sock_fd);
+ close(sock_fd);
+ exit(1);
+ }
+}
+
+
void argPortParsing(int argc, char* argv[], char* port)
{
struct option port_arg={"port", 1, NULL, 'p'};
@@ -30,8 +47,8 @@ int main(int argc, char* argv[])
char port[10]="80";
argPortParsing(argc, argv, port);
-
- int sock_fd;
+ action.sa_handler=&handler;
+ sigaction(SIGINT, &action, NULL);
if( (sock_fd=initialisationServeur(port)) ==-1 ) { fprintf(stderr, "Initialisation du serveur impossible\n"); return -1; }
diff --git a/libs/libthrd.a b/libs/libthrd.a
index b45acc1..270be3a 100644
Binary files a/libs/libthrd.a and b/libs/libthrd.a differ
--
libgit2 0.21.2