Ver Fonte

Debut BomberStudentServer

Arthur Brandao há 6 anos atrás
pai
commit
17d6fec969
4 ficheiros alterados com 34 adições e 10 exclusões
  1. 8 1
      Serveur/bomberstudent_server.c
  2. 9 0
      Serveur/bomberstudent_server.h
  3. 4 4
      Serveur/main.c
  4. 13 5
      Serveur/makefile

+ 8 - 1
Serveur/bomberstudent_server.c

@@ -7,4 +7,11 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include "bomberstudent_server.h"
+#include <pthread.h>
+#include "server.h"
+#include "bomberstudent_server.h"
+
+/* --- Fonctions publiques --- */
+boolean launch_udp_server(int port){
+    return false;
+}

+ 9 - 0
Serveur/bomberstudent_server.h

@@ -8,6 +8,15 @@
 #ifndef BOMBERSTUDENT_SERVER_H
 #define BOMBERSTUDENT_SERVER_H
 
+/* --- Include --- */
+#include "constante.h"
+
+/* --- Constantes --- */
+#define PORT_UDP 18624
+#define PORT_TCP 18642
+
+/* --- Fonctions --- */
+boolean launch_udp_server(int);
 
 #endif /* BOMBERSTUDENT_SERVER_H */
 

+ 4 - 4
Serveur/main.c

@@ -136,7 +136,7 @@ int serv(){
 int serv_udp(){
     char str[BUFFER_SIZE];
     Server s = server_create_udp();
-    s->server_bind(s, 18426);
+    s->server_bind(s, 18624);
     s->server_receive(s, str, BUFFER_SIZE);
     s->server_send(s, "i'm a bomberstudent server");
     printf("%s\n", str);
@@ -148,7 +148,7 @@ int serv_udp(){
 int serv_tcp(){
     char str[BUFFER_SIZE]; 
     Server s = server_create_tcp();
-    s->server_bind(s, 18426);
+    s->server_bind(s, 18642);
     s->server_accept(s);
     s->server_receive(s, str, BUFFER_SIZE);
     printf("%s\n", str);
@@ -164,6 +164,6 @@ int main(){
     //return encode();
     //return array_list();
     //return serv();
-    //return serv_udp();
-    return serv_tcp();
+    return serv_udp();
+    //return serv_tcp();
 }

+ 13 - 5
Serveur/makefile

@@ -3,7 +3,7 @@
 #
 
 EXEC = main
-OBJETS = str.o json_parser.o json_encoder.o error.o arraylist.o server_tcp.o server_udp.o
+OBJETS = str.o json_parser.o json_encoder.o error.o arraylist.o server_tcp.o server_udp.o bomberstudent_server.o
 NOM_PROJET = Porjet Reseau
 
 #
@@ -27,7 +27,7 @@ CC = gcc
 CCFLAGS_STD = -Wall -O3 -Werror -ansi -pedantic -std=c11
 CCFLAGS_DEBUG = -D _DEBUG_
 CCFLAGS = $(CCFLAGS_STD)
-CCLIBS = -lncurses -lm
+CCLIBS = -lm -pthread
 
 #
 # REGLES
@@ -63,6 +63,7 @@ clean:
 	@rm -f *~ *#
 	@rm -f $(EXEC)
 	@rm -f dependances
+	@rm -f *.log
 	@echo "Termine."
 
 depend:
@@ -75,6 +76,11 @@ depend:
 	@cat dependances > makefile
 	@rm dependances
 	@echo "Termine."
+	
+rmlog:
+	@echo "Suppresion des fichiers de log"
+	@rm -f *.log
+	@echo "Termine."
 
 #
 # CREATION ARCHIVE
@@ -93,6 +99,8 @@ json_parser.o: json_parser.c json.h str.h constante.h
 json_encoder.o: json_encoder.c json.h str.h constante.h
 error.o: error.c str.h error.h
 arraylist.o: arraylist.c str.h arraylist.h constante.h
-server_tcp.o: server_tcp.c error.h server.h
-server_udp.o: server_udp.c error.h server.h
-main.o: main.c json.h str.h constante.h arraylist.h
+server_tcp.o: server_tcp.c error.h server.h constante.h
+server_udp.o: server_udp.c error.h server.h constante.h
+bomberstudent_server.o: bomberstudent_server.c server.h constante.h \
+ bomberstudent_server.h
+main.o: main.c json.h str.h constante.h arraylist.h server.h error.h