java.net.BindException: Address already in use: JVM_Bind at java.net.DualStackPlainSocketImpl.bind0(Native Method) at java.net.DualStackPlainSocketImpl.socketBind(Unknown Source) at java.net.AbstractPlainSocketImpl.bind(Unknown Source) at java.net.PlainSocketImpl.bind(Unknown Source) at java.net.ServerSocket.bind(Unknown Source) at java.net.ServerSocket.<init>(Unknown Source) at java.net.ServerSocket.<init>(Unknown Source) at server.main(server.java:20)
try { ServerSocket ss = new ServerSocket(5555); System.out.println("Running...."); Socket s = ss.accept(); System.out.println("Accept"); @SuppressWarnings("resource") FileInputStream fis = new FileInputStream("E:/Face"); byte[]buffer = new byte[fis.available()]; fis.read(buffer); ObjectOutputStream oos = new ObjectOutputStream(s.getOutputStream()); oos.writeObject(buffer); oos.close(); ss.close(); s.close(); } catch(IOException e) { e.printStackTrace(); } }
try { Socket s = new Socket("127.0.0.1",5555); ObjectInputStream ois = new ObjectInputStream(s.getInputStream()); try { byte[]buffer = (byte[]) ois.readObject(); FileOutputStream oos = new FileOutputStream("/sdcard/DCIM"); oos.write(buffer); oos.close(); } catch(ClassNotFoundException e){ e.printStackTrace(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (OptionalDataException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } s.close(); } catch(NumberFormatException e){ e.printStackTrace(); } catch (UnknownHostException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)