Strumenti Utente

Strumenti Sito


lpr-b-2007-2008: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-2007-2008/remoteinputstream.txt · Ultima modifica: 19/09/2008 alle 14:08 (16 anni fa) da 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki