问题描述
Customer cus = new Customer(); ServerSocket s = null; public AddCustomer() { } public void getCustomerDetail() { String back = " "; { try { s = new ServerSocket(5433); } catch (IOException e) { System.out.println("Error:" + e.getMessage()); System.exit(0); } while (back.equals(" ")) { try { Socket s1 = s.accept(); System.out.println("Connection established at port 5433"); InputStream is = s1.getInputStream(); ObjectInputStream dis = new ObjectInputStream(is); System.out.println("Getting data..."); cus = (Customer)dis.readobject(); System.out.println(cus.toString()); System.out.println(cus.getName()); dis.close(); s1.close(); System.out.println("Connection closed."); } catch (ConnectException connExcep) { System.out.println("1Error: " + connExcep.getMessage()); } catch (IOException ioExcep) { System.out.println("2Error: " + ioExcep.getMessage()); } catch (Exception e) { System.out.println("3Error: " + e.getMessage()); } new AddCustomer().addCustomerToDB(); } } } public void addCustomerToDB() { System.out.println("start "); Connection connection = null; Statement statement = null; int check = 1; System.out.println(cus.getName()+"dadawd"); }
在服务器上,我得到了文件,但是它的长度增加了几个字节,当然,该文件还是有问题的。因此,在发送文件之前,文件的长度是6612,但是服务器获取的文件长度是6809,有人可以给我一些如何修复文件的建议吗?预先感谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)