#include #include #include #include #include "libnet.h" void argPortParsing(int argc, char* argv[], char* port) { struct option port_arg={"port", 1, NULL, 'p'}; char opt; int longindex; while( (opt=getopt_long(argc, argv, "p:", &port_arg, &longindex)) !='p' && opt!=-1) {} if(opt=='p') { strcpy(port, optarg); printf("%s\n", optarg); } else { printf("La syntaxe doit ĂȘtre de la forme %s -p ou %s --port \n\n", argv[0], argv[0]); } } int main(int argc, char* argv[]) { char port[10]="80"; argPortParsing(argc, argv, port); int sock_fd=initialisationServeur(port); if( sock_fd==-1 ) { fprintf(stderr, "Initialisation du serveur impossible\n"); return -1; } boucleServeur(sock_fd, (void*)&reponseConnexion); sendUDPBroadcast("BroadWesh", 2020); return 0; }