Java Socket Read readMsg(Socket s)

Here you can find the source of readMsg(Socket s)

Description

read Msg

License

Open Source License

Declaration

public static String readMsg(Socket s) throws Exception 

Method Source Code

//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*/
}

Related

  1. getPrintWriter(Socket s)
  2. getPrintWriterFromOutputStream(Socket socket)
  3. getResponse(Socket socket)
  4. readBytesIntoSocket(Socket socket)
  5. readData(Socket connId, byte[] dataRead, int nchar)