How Do I Create An Input Stream

  • 4 Dec, 2011

    On the client side, you can use the DataInputStream class to create an input stream to receive response from the server:DataInputStream input;try {input = new DataInputStream(MyClient.getInputStream());}catch (IOException e) {System.out.println(e);}The class DataInputStream allows you to read lines of text and Java primitive data types in a portable way. It has methods such as read, readChar, readInt, readDouble, and readLine,. Use whichever function you think suits your needs depending on the type of data that you receive from the server.On the server side, you can use DataInputStream to receive input from the client:DataInputStream input;try {input = new DataInputStream(serviceSocket.getInputStream());}catch (IOException e) {System.out.println(e);}

    Comments Received:
    Please give your suggestions and feedback:

2009-2016 All rights reserved.