| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 
 |  
try {
	String msgSizeFile;
	msgSizeFile = in.readLine();
	Log.d("reception :", "-------Recu : "+ msgSizeFile);
	String tabmsg[];
	tabmsg=msgSizeFile.split("_");
	int sizeFile = Integer.parseInt(tabmsg[2]);
 
	File monFichier = new File ("config.xml");
	if (monFichier.exists()) {	            	
	         // receive file
		byte[] mybytearray = new byte[sizeFile];
		FileOutputStream fs = new FileOutputStream(monFichier);
		BufferedOutputStream bOut = new BufferedOutputStream(fs);
		BufferedInputStream bIN = new BufferedInputStream(socket.getInputStream());
		bIN.read(mybytearray,0,sizeFile);
		fs.write(mybytearray);
		bOut.write(mybytearray, 0, mybytearray.length);
 
	  }
 
} catch (IOException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
} | 
Partager