Cant communicate with server in java
- by cerq
i m trying to write server to client program but i cant communicate with server in java. Below there is code block in my main. 
    InetAddress addr = InetAddress.getLocalHost();
    ipAddress = "78.162.206.164";
    ServerSocket serverSocket = new ServerSocket(0);
    String randomStringForPlayerName = RandomStringGenerator.generateRandomString(); 
    baseForReqOpp += ipAddress + " " + serverSocket + " " + randomStringForPlayerName;
    Socket socket = new Socket(host,2050); 
    socket.setSoTimeout(100);
    in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    out = new PrintWriter(socket.getOutputStream());
    out.write(baseForReqOpp);
    out.flush();
    System.out.println(in.read());
i know there is no problem in server code and all the ports in communication are ok. But i cant read anything from server. What can be the problem?