What am I doing with the sockets?



  • Java code

    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket=new ServerSocket(7475);
        System.out.print(serverSocket.getInetAddress()+"  "+ serverSocket.getLocalPort());
        Socket socket=serverSocket.accept();
        System.out.print("DA");
        socket.close();
    }
    

    Android code

     new Thread(new Runnable() {
                @Override
                public void run() {
                    try{
                        client = new Socket("127.0.0.1", 7475);
                        client.setSoTimeout(100);
                        DataOutputStream dataOutputStream = new DataOutputStream(client.getOutputStream());
                        dataOutputStream.writeUTF("asd");
                        dataOutputStream.flush();
                        dataOutputStream.close();
                        client.close();
    
                } catch (SocketException e) {
                    Log.e("ERROR", "1");
                    e.printStackTrace();
                } catch (IOException e) {
                    Log.e("ERROR", "3");
                    e.printStackTrace();
                }
            }
        }).start();
    

    In the end, I get Error 1, the fucking port is auditioning, hitting through netstup, I don't know what to do, the antivirals are off, the whole pointless Android on Ginemotyion.



  • You have Androids trying to connect to the elbows. Socket("127.0.0.1", 7475);I mean, by 7475 Android.

    To join the computer where the juket's up, look at the construction of his ip computer network on the local network and join it.

    That is, of course, provided that both PC and Android on one local network.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2