The list of methods to do Socket Read are organized into topic(s).
String
dump(final Socket socket) Dumps the state of a socket
if (socket == null)
return "Socket [null]";
final StringBuilder b = new StringBuilder("Socket [");
b.append("\n\tConnected:").append(socket.isConnected());
final SocketAddress lsa = socket.getLocalSocketAddress();
final SocketAddress sa = socket.getRemoteSocketAddress();
if (sa != null && (sa instanceof InetSocketAddress)) {
final InetSocketAddress isa = (InetSocketAddress) sa;
...
InputStream
getInputStream(Socket socket) get Input Stream
try {
return socket.getInputStream();
} catch (IOException e) {
e.printStackTrace();
return null;
String
getResponse(Socket socket) get Response
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String response = in.readLine();
return response;
byte[]
readBytesIntoSocket(Socket socket) read Bytes Into Socket
DataInputStream dis = new DataInputStream(socket.getInputStream());
ByteArrayOutputStream out = new ByteArrayOutputStream();
int count = 0;
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
while (dis.available() == 0) {
Thread.sleep(1);
while ((count = dis.read(buffer)) > 0) {
...
int
readData(Socket connId, byte[] dataRead, int nchar) Reads nchar from a given sockets, blocks on read untill nchar are read of conenction has error bRead returns the bytes read
InputStream input;
input = connId.getInputStream();
int nread = 0;
int startTime = (int) (new Date().getTime());
do {
if (input.available() != 0) {
nread += input.read(dataRead, nread, nchar - nread);
startTime = (int) (new Date().getTime());
...