// Path: AndroidServer-v4/src/com/newppt/android/entity/DMT.java
// public class DMT implements Serializable{
// 
// 	private int currentPage;
// 	private  int page;
// 	private  String filename;
// 	
// 	public String getFilename()
// 	{
// 		return filename;
// 	}
// 	
// 	public void setFilename(String name)
// 	{
// 		this.filename=name;
// 	}
// 
// 	public int getCurrentPage()
// 	{
// 		return currentPage;
// 	}
// 	
// 	public int getPages()
// 	{
// 		return page;
// 	}
// 	
// 	public void setCurrentPage(int currentPage)
// 	{
// 		this.currentPage=currentPage;
// 	}
// 	
// 	public void setPage(int page) 
// 	{
// 		this.page=page;
// 	}
// }
// 
// Path: Android_v5/src/com/newppt/android/entity/MyPath.java
// public class MyPath {
// 	
// 	public  static String rootPath = Environment.getExternalStorageDirectory() + "/"
// 			+ "AndroidPPT/";
// 	public static String savePptFilePath = Environment.getExternalStorageDirectory() + "/"
// 			+ "AndroidPPTFile/";
// 	public static String jpgPath = rootPath + "ppt.jpg";
// 	
// 	public static String pptJpg = "/ppt";
// 	public static String noteJpg = "/note";
// 	
// 	String fileName ="ppt.jpg";
// 
// 	public MyPath() {
// 		// TODO Auto-generated constructor stub
// 	}
// 	
// 	public String returnRootPath() {
// 		return rootPath;
// 	}
// 	
// 	public String returnJpgPath() {
// 		return jpgPath;
// 	}
// 	
// 	public String returnFileName() {
// 		return fileName;
// 	}
// 
// }


import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.PublicKey;
import com.newppt.android.entity.DMT;
import com.newppt.android.entity.MyPath;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
package com.newppt.android.data;




public class SendFileClient extends Thread {
//	private Socket s;
	String ip;
	int port = 8889;
	Handler handler;
	String typeString;
	final int timeOut = 5000;
	
	public SendFileClient(String ip, Handler handler, String type) {
		// TODO Auto-generated constructor stub
		this.ip = ip;
		this.handler = handler;
		this.typeString = type;
	}

	@Override
	public void run() {
		// TODO Auto-generated method stub
		loadFile();
	}

	/**
	 * ä¸è½½æä»¶å½æ°
	 */
	private void loadFile() {
		try {
//			Socket s = new Socket(ip, port);
			
			Socket s = new Socket();
//			 System.out.println("------1-4-0");
			s.connect(new InetSocketAddress(ip, port), timeOut);
//			 System.out.println("------1-3-0");
			
			
			byte[] buf = new byte[100];
			DataOutputStream os = null;
			os = new DataOutputStream(s.getOutputStream());
			os.writeUTF(typeString);
			System.out.println("-----kk----11" );
			
			s.setSoTimeout(timeOut);
			
			InputStream is = s.getInputStream();
			// ½ÓÊÕ´«ÊäÀ´µÄÎÄ¼þÃû
			int len = is.read(buf);
			String fileName = new String(buf, 0, len,"GBK");
			
			System.out.println(fileName);
// Path: AndroidServer-v4/src/com/newppt/android/entity/DMT.java
// public class DMT implements Serializable{
// 
// 	private int currentPage;
// 	private  int page;
// 	private  String filename;
// 	
// 	public String getFilename()
// 	{
// 		return filename;
// 	}
// 	
// 	public void setFilename(String name)
// 	{
// 		this.filename=name;
// 	}
// 
// 	public int getCurrentPage()
// 	{
// 		return currentPage;
// 	}
// 	
// 	public int getPages()
// 	{
// 		return page;
// 	}
// 	
// 	public void setCurrentPage(int currentPage)
// 	{
// 		this.currentPage=currentPage;
// 	}
// 	
// 	public void setPage(int page) 
// 	{
// 		this.page=page;
// 	}
// }
// 
// Path: Android_v5/src/com/newppt/android/entity/MyPath.java
// public class MyPath {
// 	
// 	public  static String rootPath = Environment.getExternalStorageDirectory() + "/"
// 			+ "AndroidPPT/";
// 	public static String savePptFilePath = Environment.getExternalStorageDirectory() + "/"
// 			+ "AndroidPPTFile/";
// 	public static String jpgPath = rootPath + "ppt.jpg";
// 	
// 	public static String pptJpg = "/ppt";
// 	public static String noteJpg = "/note";
// 	
// 	String fileName ="ppt.jpg";
// 
// 	public MyPath() {
// 		// TODO Auto-generated constructor stub
// 	}
// 	
// 	public String returnRootPath() {
// 		return rootPath;
// 	}
// 	
// 	public String returnJpgPath() {
// 		return jpgPath;
// 	}
// 	
// 	public String returnFileName() {
// 		return fileName;
// 	}
// 
// }


// Path: Android_v5/src/com/newppt/android/data/SendFileClient.java
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.PublicKey;
import com.newppt.android.entity.DMT;
import com.newppt.android.entity.MyPath;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;

package com.newppt.android.data;




public class SendFileClient extends Thread {
//	private Socket s;
	String ip;
	int port = 8889;
	Handler handler;
	String typeString;
	final int timeOut = 5000;
	
	public SendFileClient(String ip, Handler handler, String type) {
		// TODO Auto-generated constructor stub
		this.ip = ip;
		this.handler = handler;
		this.typeString = type;
	}

	@Override
	public void run() {
		// TODO Auto-generated method stub
		loadFile();
	}

	/**
	 * ä¸è½½æä»¶å½æ°
	 */
	private void loadFile() {
		try {
//			Socket s = new Socket(ip, port);
			
			Socket s = new Socket();
//			 System.out.println("------1-4-0");
			s.connect(new InetSocketAddress(ip, port), timeOut);
//			 System.out.println("------1-3-0");
			
			
			byte[] buf = new byte[100];
			DataOutputStream os = null;
			os = new DataOutputStream(s.getOutputStream());
			os.writeUTF(typeString);
			System.out.println("-----kk----11" );
			
			s.setSoTimeout(timeOut);
			
			InputStream is = s.getInputStream();
			// ½ÓÊÕ´«ÊäÀ´µÄÎÄ¼þÃû
			int len = is.read(buf);
			String fileName = new String(buf, 0, len,"GBK");
			
			System.out.println(fileName);
			String savePath = MyPath.savePptFilePath + fileName;