Here you can find the source of readMsg(Socket s)
public static String readMsg(Socket s) throws Exception
//package com.java2s; //License from project: Open Source License import java.net.Socket; public class Main { public static String readMsg(Socket s) throws Exception { byte[] msgBytes = new byte[1024]; int read = s.getInputStream().read(msgBytes); return (read > 0 ? new String(msgBytes, 0, read) : ""); }/* w ww .j av a2 s. c o m*/ }