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();
	}
}