Bonjour tout est dans le titre
j'aimerais récupérer une liste de fichier de mon PC et l'afficher sur mon smartphone
je vous montre mon code

coté serveur (java):
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
	import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.UnknownHostException;
 
public class Mot_Serveur {
 
	public static File f=new File("C:\\Users\\JM\\Downloads");
 
	    public static void main(String[] zero) throws IOException {
 
	    	ServerSocket socketserver;
	    	Socket serverClient;
	    	ObjectOutputStream out;
			String[] liste_fichier = f.list();
 
	    	try{
	        socketserver = new ServerSocket(8666) ;
	        serverClient = socketserver.accept() ;
	        out = new ObjectOutputStream(serverClient.getOutputStream());
	        out.writeObject(liste_fichier);
	        out.flush();
	        out.close();	
	        serverClient.close();
		    }
		    catch (UnknownHostException e) {
 
	            e.printStackTrace();
	        }
		    catch (FileNotFoundException e) {
		        e.printStackTrace();
		    } catch (IOException e) {
		        e.printStackTrace();
		      }   
	    	}
	    }
coté client:
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
package com.example.mot_client;
 
import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.Socket;
 
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.ListView;
 
public class MainActivity extends Activity {
 
	private Handler handler = new Handler();
 
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		TraitementDonnées();
	}
	private void TraitementDonnées() {
 
		Thread thread = new Thread(null,doBackgroundThreadProcessing,"Background");
		thread.start();
	}
	private Runnable doBackgroundThreadProcessing = new Runnable() {
 
			@Override
			public void run() {
				ObjectInputStream in ;
				Socket socket;
				final String reception[];
				try{
					//on etablie la connection et on récupère le flux entrant de la socket
					socket = new Socket("192.168.0.11",8666);
					Log.v("Connection","etablie !");
					in = new ObjectInputStream(socket.getInputStream());
					//on stocke recupère les données sur la socket
					reception = (String[]) in.readObject();
					handler.post(new Runnable(){
						@Override
						public void run() {
							// TODO Auto-generated method stub
							ListView list = (ListView)findViewById(R.id.listView1);	
							ArrayAdapter adapter = new ArrayAdapter<String>(getApplicationContext(),android.R.layout.simple_list_item_1,reception);
							list.setAdapter(adapter);
						}
					});
					socket.close();
				} catch (IOException e) {
					Log.e("PAO","IO Exception.", e);
				} catch (ClassNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
 
		};
 
 
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}
 
}
et voici les erreurs que j'obtiens
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
01-30 01:23:20.905: D/CLIPBOARD(23514): Hide Clipboard dialog at Starting input: finished by someone else... !
01-30 01:23:26.450: E/PAO(23514): IO Exception.
01-30 01:23:26.450: E/PAO(23514): java.net.SocketException: socket failed: EACCES (Permission denied)
01-30 01:23:26.450: E/PAO(23514): 	at libcore.io.IoBridge.socket(IoBridge.java:573)
01-30 01:23:26.450: E/PAO(23514): 	at java.net.PlainSocketImpl.create(PlainSocketImpl.java:201)
01-30 01:23:26.450: E/PAO(23514): 	at java.net.Socket.startupSocket(Socket.java:559)
01-30 01:23:26.450: E/PAO(23514): 	at java.net.Socket.tryAllAddresses(Socket.java:127)
01-30 01:23:26.450: E/PAO(23514): 	at java.net.Socket.<init>(Socket.java:177)
01-30 01:23:26.450: E/PAO(23514): 	at java.net.Socket.<init>(Socket.java:149)
01-30 01:23:26.450: E/PAO(23514): 	at com.example.mot_client.MainActivity$1.run(MainActivity.java:38)
01-30 01:23:26.450: E/PAO(23514): 	at java.lang.Thread.run(Thread.java:856)
01-30 01:23:26.450: E/PAO(23514): Caused by: libcore.io.ErrnoException: socket failed: EACCES (Permission denied)
01-30 01:23:26.450: E/PAO(23514): 	at libcore.io.Posix.socket(Native Method)
01-30 01:23:26.450: E/PAO(23514): 	at libcore.io.BlockGuardOs.socket(BlockGuardOs.java:181)
01-30 01:23:26.450: E/PAO(23514): 	at libcore.io.IoBridge.socket(IoBridge.java:558)
01-30 01:23:26.450: E/PAO(23514): 	... 7 more
01-30 01:23:50.900: W/IInputConnectionWrapper(23514): getExtractedText on inactive InputConnection
01-30 01:23:50.925: W/IInputConnectionWrapper(23514): getExtractedText on inactive InputConnection
merci de votre aide !