0

80 個の 4 バイト int フィールドで構成されるサーバーから 320 バイトのデータを受信する必要があります。それらを 4 バイトで受け取り、それぞれの int 値を表示するにはどうすればよいですか? ありがとう。

これが受信側に適しているかどうかはわかりません:

//for reading the data from the socket 

BufferedInputStream bufferinput=new BufferedInputStream(NewSocket.getInputStream());

DataInputStream datainput=new DataInputStream(bufferinput);

byte[] handsize=new byte[32];

// The control will halt at the below statement till all the 32 bytes are not read from the socket.  

datainput.readFully(handsize); 
4

1 に答える 1

6
for (int i = 0; i < 80; i++) {
    System.out.println(datainput.readInt());
}
于 2010-03-21T10:27:49.917 に答える