Bonjour, pouvez-vous m'aider? Je n'arrive pas a compiler mon code a cause de cette erreur :
TCPIP2.java:14: non-static method socket() cannot be referenced from a static context
serverSocket = ServerSocketChannel.socket();
^
1 error

Processus terminé avec code quitter 1
Et voici tout mon code :
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
import java.net.*;
import java.io.*;
import java.security.*;
import java.nio.channels.*;
class Temp{
	private ServerSocketChannel serverSocketChannel = null;
	private ServerSocket serverSocket = null;
	private Socket clientSocket = null;
	private boolean fin = false;
	Temp(){
		try{
			SocketAddress address = new InetSocketAddress(9999);
			serverSocketChannel = ServerSocketChannel.open();
			serverSocket = ServerSocketChannel.socket();
			serverSocket.bind(address);
 
			while(!fin){
				try{
					clientSocket = serverSocket.accept();
					//Traitement sur le clients Socket
				} catch(ClosedByInterruptException IException){
					fin = true;
				}
			}
		} catch(IOException IException){
			//TODO Auto-generated catch block
			IException.printStackTrace();
		} finally {
			try{
				if(serverSocket != null) serverSocket.close();
			} catch(Exception IException){
				//ERREUR
			}
			try{
				if(serverSocketChannel!=null) serverSocketChannel.close();
			} catch(Exception IException){
				//////ERREUR
			}
		}
	}
	public void setStatut(boolean setter){
		fin = setter;
	}
}
public class TCPIP2{
	public static void main(String arg[]){
	}
}
class Fonction{
	static public String MD5(String password){
    	try{
			MessageDigest md = MessageDigest.getInstance("MD5");
    		md.update(password.getBytes());
    		byte[] md5 = md.digest();
    		return new String(md5);
		}catch(Exception e){
			return "";
		}
  	}
}
Merci de votre aide :o