Skip to content
Snippets Groups Projects
Commit 5d55dbe1 authored by Paul Ripault's avatar Paul Ripault
Browse files

fin chapitre 3

parent 1b429684
No related branches found
Tags 02-serveur-tcp-simple
No related merge requests found
1.Le client arrète de recevoir des messages
2.Rien ne s'affiche comme le paramètre "-z" empèche les entrées et les sorties. Il est utilisé pour scanner
3.La connection est refusée.
4.Le premier client continue de recevoir alors que le second attend
No preview for this file type
......@@ -36,8 +36,10 @@ int creer_serveur(int port){
}
/* On peut maintenant dialoguer avec le client */
const char *message_bienvenue = "Bonjour, bienvenue sur mon serveur\nExcogitatum est super his, ut homines quidam ignoti, vilitate ipsa parum cavendi ad colligendos rumores per Antiochiae latera cuncta destinarentur relaturi quae audirent. hi peragranter et dissimulanter honoratorum circulis adsistendo pervadendoque divites domus egentium habitu quicquid noscere poterant vel audire latenter intromissi per posticas in regiam nuntiabant, id observantes conspiratione concordi, ut fingerent quaedam et cognita duplicarent in peius, laudes vero supprimerent Caesaris, quas invitis conpluribus formido malorum inpendentium exprimebat.Sed fruatur sane hoc solacio atque hanc insignem ignominiam, quoniam uni praeter se inusta sit, putet esse leviorem, dum modo, cuius exemplo se consolatur, eius exitum expectet, praesertim cum in Albucio nec Pisonis libidines nec audacia Gabini fuerit ac tamen hac una plaga conciderit, ignominia senatus.Post emensos insuperabilis expeditionis eventus languentibus partium animis, quas periculorum varietas fregerat et laborum, nondum tubarum cessante clangore vel milite locato per stationes hibernas, fortunae saevientis procellae tempestates alias rebus infudere communibus per multa illa et dira facinora Caesaris Galli, qui ex squalore imo miseriarum in aetatis adultae primitiis ad principale culmen insperato saltu provectus ultra terminos potestatis delatae procurrens asperitate nimia cuncta foedabat. propinquitate enim regiae stirpis gentilitateque etiam tum Constantini nominis efferebatur in fastus, si plus valuisset, ausurus hostilia in auctorem suae felicitatis, ut videbatur.";
write(socket_client, message_bienvenue, strlen(message_bienvenue));
while(1){
write(socket_client, message_bienvenue, strlen(message_bienvenue));
sleep(1);
}
int optval=1;
if (setsockopt(socket_client, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(int)) == -1) {
perror("Can not set SO_REUSEADDR option");
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment