class UdpData
{
public UdpData() {}
public void read(String host, byte[] buffer, short[] ch1)
{int i, len=0;
InputStream in;
OutputStream out;
Socket server;
try
{server = new Socket(host, 8888, false);
in = server.getInputStream();
out = server.getOutputStream();
out.write(buffer, 0, 4);
out.flush();
len = in.read(buffer);
server.close();
}
catch(Exception exception) {len = 0;}
try
{WindowsStream input =
new WindowsStream(new ByteArrayInputStream(buffer));
for (i = 0;i < 1024;i++) ch1[i] = input.readShort();
}
catch(Exception e) {;}
}
}
End of Listing