Strumenti Utente

Strumenti Sito


lpr-b:remoteinputstream
package nfs;
import java.net.DatagramPacket;
 
public class RemoteInputStream extends RemoteStream{
 
	public RemoteInputStream(String serverName) {
		super(serverName);
	}
 
	public byte[] read(int len) {
		UDPServerComm comm = new UDPServerComm(serverName, NfsServer.port);
		DatagramPacket dp = RemotePacket.RemotePacket("READ",handle,(new Integer(len)).toString());
		// packet received: contains the String remote handle
		DatagramPacket answer = comm.call(dp);
		if(answer == null) 
			return null; // error receiving
		String error = new String(answer.getData(),0,answer.getLength());
		return answer.getData();
	}
}
lpr-b/remoteinputstream.txt · Ultima modifica: 19/11/2007 alle 15:14 (12 anni fa) da Sonia Campa