the class of client in android application (using emulator localhost), sending a string to my java application (serveur) :
   public class Client_socket  extends MainActivity{
     private static Socket socket;
        public static void lance()
        {
            try
            {
                String host = "localhost";
                int port = 25000;
                InetAddress address = InetAddress.getByName(host);
                socket = new Socket("127.0.0.3", port);
                //Send the message to the server
                OutputStream os = socket.getOutputStream();
                OutputStreamWriter osw = new OutputStreamWriter(os);
                BufferedWriter bw = new BufferedWriter(osw);
                String nom = "premiere";
                String sendMessage = ism + "\n";
                bw.write(sendMessage);
                bw.flush();
                System.out.println("Message sent to the server : "+sendMessage);
                //Get the return message from the server
                InputStream is = socket.getInputStream();
                InputStreamReader isr = new InputStreamReader(is);
                BufferedReader br = new BufferedReader(isr);
                String message = br.readLine();
                System.out.println("Message received from the server : " +message);
            }
            catch (Exception exception)
            {
                exception.printStackTrace();
            }
            finally
            {
                //Closing the socket
                try
                {
                    socket.close();
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
            }
        }
}
the class of serveur in java application how recive my string : what the ip and port can i use?, and how can i get my ip?
public class Server
{
    private static Socket socket;
    public static void main(String[] args)
    {
        try
        {
            int port = 25000;
            ServerSocket serverSocket = new ServerSocket(port);
            System.out.println("Server Started and listening to the port 25000");
            //Server is running always. This is done using this while(true) loop
            while(true)
            {
                //Reading the message from the client
                socket = serverSocket.accept();
                InputStream is = socket.getInputStream();
                InputStreamReader isr = new InputStreamReader(is);
                BufferedReader br = new BufferedReader(isr);
                String nom = br.readLine();
                System.out.println("Message received from client is "+nom);
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        finally
        {
            try
            {
                socket.close();
            }
            catch(Exception e){}
        }
    }
}
 
    