Bonjour,

j'essaye de voir mon serveur UDP sur le port 1234 avec la commande nmap mais il n'apparaît pas :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
 
$ nmap localhost
 
Starting Nmap 4.76 ( http://nmap.org ) at 2009-06-10 23:25 CEST
All 1000 scanned ports on localhost (127.0.0.1) are closed
 
Nmap done: 1 IP address (1 host up) scanned in 0.29 seconds
Voici le code de mon serveur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
 
int main(int argc, char *argv[]){
 
	/* Initialize SDL */
	if(SDL_Init(0)==-1) {
		printf("main: error 1: SDL_Init: '%s'\n", SDL_GetError());
		return(-1);
	}
 
	/* Initialize SDL_net */
	if(SDLNet_Init()==-1) {
		printf("main: error 2: SDLNet_Init: '%s'\n", SDLNet_GetError());
 
		/* Close SDL */
		SDL_Quit();
 
		return(-1);
	}
 
	UDPsocket udpsocket; /* The UDP socket */
	IPaddress ipaddress; /* The IP address */
	Uint16 port; /* The port */
	UDPpacket packet; /* The UDP packet */
	int ret_recv; /* The return value of SDLNet_UDP_Recv */
 
	/* Initialize the port */
	port = 1234;
 
	/* Resolve the host */
	if( SDLNet_ResolveHost(&ipaddress, NULL, port) == -1 ){
		printf("main: error 3: SDLNet_ResolveHost: '%s'\n", SDLNet_GetError());
 
		/* Close SDL_net */
		SDLNet_Quit();
 
		/* Close SDL */
		SDL_Quit();
 
		return(-1);
	}
 
	/* Open the UDP socket */
	udpsocket=SDLNet_UDP_Open(port);
	if(!udpsocket){
		printf("main: error 4: SDLNet_UDP_Open: '%s'\n", SDLNet_GetError());
 
		/* Close SDL_net */
		SDLNet_Quit();
 
		/* Close SDL */
		SDL_Quit();
 
		return(-1);
	}
 
	/* Bind address */
	if( SDLNet_UDP_Bind(udpsocket, -1, &ipaddress) == -1 ){
		printf("main: error 5:  SDLNet_UDP_Bind: '%s'\n", SDLNet_GetError());
 
		/* Close SDL_net */
		SDLNet_Quit();
 
		/* Close SDL */
		SDL_Quit();
 
		return(-1);
	}
 
	while(1){
		/* Try to receive a waiting udp packet */
		ret_recv = SDLNet_UDP_Recv(udpsocket, &packet);
		switch(ret_recv){
			case -1:
				printf("main: error 6: SDLNet_UDP_Recv: '%s'\n", SDLNet_GetError());
				/* Close SDL_net */
				SDLNet_Quit();
 
				/* Close SDL */
				SDL_Quit();
 
				return(-1);
				break;
			case 0:
				printf("No packet received.\n");
				break;
			case 1:
				printf("One packet received.\n");
				break;
		}
		/* Stand a moment */
		sleep(1);
	}
 
	/* Close SDL_net */
	SDLNet_Quit();
 
	/* Close SDL */
	SDL_Quit();
 
	return(0);
}
Je me suis aidé de cette documentation :
http://jcatki.no-ip.org:8080/SDL_net/

Le serveur semble pourtant bien se lancer :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
$ ./server
No packet received.
No packet received.
No packet received.
[...]
Aidez moi SVP à voir mon serveur (le port 1234/UDP ouvert).
Merci.