Guillaume of IUT
Messages postés1Date d'inscriptiondimanche 7 décembre 2003StatutMembreDernière intervention 6 février 2004
-
6 févr. 2004 à 21:18
neoTHGLF
Messages postés65Date d'inscriptiondimanche 7 septembre 2003StatutMembreDernière intervention17 décembre 2007
-
13 févr. 2004 à 13:41
Salut à tous, j'ai un problème. Voici le code du serveur en C. C'est pratiquement l'exemple qui est livré avec les librairies tcp lsck073b. Le probleme est à l'exécution. Le bind foire et le perror m'affiche "No such device <ENODEV>"
/*
* Demo programme for libsocket for DJGPP
* This demonstrates the use of libsocket.
* This is server.
* This file will compile also under Linux.
*
* Copyright 1997, 1998 by Indrek Mandre
*/
int main(void)
{
struct sockaddr_in in;
struct sockaddr_in peer_in;
int sock;
char PORT[256];
char MESSAGE[256];
int newsock;
int len;
char buf[256];
char HOST[256];
/*
* Now we read from user on which port he wants the server crawl and
* which message will be sent to clients.
*/
printf ("Entrer l'adresse ip : ");
gets (HOST);
printf ("Entrer le numero de port : ");
gets (PORT);
printf ("Enter message we send to clients: ");
gets (MESSAGE);
/*
* At first we have to create socket.
* After that we bind it on desired port and after that we begin
* to listen it.
*/
memset ( &in, 0, sizeof ( struct sockaddr_in ) );
sock = socket ( AF_INET, SOCK_STREAM, 0 );
in.sin_family = AF_INET;
// in.sin_addr.s_addr = INADDR_ANY; // Remplit mal la structure sockaddr_in au niveau de l'adresse ip vérifiable avec la fonction d'affichage
in.sin_addr.s_addr = inet_addr ( HOST ); // Remplace INADDR_ANY
in.sin_port = htons ( atoi ( PORT ) );
/*
* Infinite loop.
* We use accept to get new client. The socket is blocking, so accept
* waits while new client arrives. Accept returns the new socket's
* descriptor. peer_in will be filled with the address of the client.
* We receive the message that client send and send our message back.
* After that we close the connection.
*/
neoTHGLF
Messages postés65Date d'inscriptiondimanche 7 septembre 2003StatutMembreDernière intervention17 décembre 2007 13 févr. 2004 à 13:30
Bonjour,
Je ne pense pas que ça vienne de ton programme. Ca doit venir de ta configuration réseau. Désolé, je ne peux pas t'aider plus, je ne vois pas vraiment d'où ça vient. Peut-être que ENODEV est une interface comme eth0. Le programme cherche l'interface ENODEV et ne la trouve pas car elle n'existe pas ? peut-être...