参考资料来源:百度贴吧
用Socket类去连接\x0d\x0a String ip = "192.168.0.57"\x0d\x0a int port=7000\x0d\x0a InputStream in\x0d\x0a OutputStream out\x0d\x0aSocket sock = null \x0d\x0a try {\x0d\x0a sock = new Socket(ip,port)\x0d\x0a sock.setSoTimeout(60*1000)//设置超时\x0d\x0a this.in = sock.getInputStream()\x0d\x0a this.out = sock.getOutputStream()\x0d\x0a } catch (Exception e) {\x0d\x0a throw new Exception("与终端连接失败!")\x0d\x0a }欢迎分享,转载请注明来源:夏雨云
评论列表(0条)