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.bean.req.Prot20001ReqBean;
import cn.net.cpzslibs.prot.handset.newProt.Prot20059NongYaoGetProduct;

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

		String ip = "218.245.0.108"; // 218.245.0.109  192.168.0.46 
		int port = 8990; 
		SocketCreate create = new SocketCreate(ip, port, "");
		
		try {
			create.createLoginCpzsHandset(358001106L);
			// 获取产品列表      
			
			Prot20059NongYaoGetProduct p01 = new Prot20059NongYaoGetProduct();
			p01.reqProductList(create, new Prot20001ReqBean(create.getiDeviceId()+""));
			
			System.out.println(p01.getResBean());	
		
		
			
			/*Prot20058NongYaoPiCi  p58 = new Prot20058NongYaoPiCi();
			p58.reqDealerInfo(create);  
			System.out.println(p58.getResBean().getList());*/
			
			
			
			
		} 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);
		}
	
		
	}
}
