package cn.net.test;

import java.io.IOException;
import java.net.BindException;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;

import cn.net.cpzslibs.prot.Prot02Logout;
import cn.net.cpzslibs.prot.SocketCreate;
import cn.net.cpzslibs.prot.handset.Prot10049UpPicture2;

public class Handset10049 {
	public static void main(String[] args) {

		String ip = "218.245.0.109";// 218.245.0.109 192.168.0.46
		int port = 8898;
		SocketCreate create = new SocketCreate(ip, port, "458000280");
		try {

			create.createLoginCpzsHandset(458000280L);
			// companyid_养殖管理ID_breedManger_<order>
			if (create.isResult()) {
				String picName = "458000280_1_breedManger_1";
				Prot10049UpPicture2 p49 = new Prot10049UpPicture2(picName, "jpg");
				p49.dealPicture(create, "D:\\testEcho.png");
				// p49.dealPicture(create, "D:\\20160708172009.jpg");
				System.out.println((p49.getFailNum() == 0 ? "上传成功" : "上传失败   ") + " failNum:" + p49.getFailNum());
			}

			// p49.dealPicture(create, "");

		} catch (BindException e) {
			e.printStackTrace();
		} catch (ConnectException e) {
			e.printStackTrace();
		} catch (SocketTimeoutException e) {
			e.printStackTrace();
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			new Prot02Logout().dealLogout(create);
		}

	}

}
