java client;now is ok.
wuhao at bokee.net
wuhao at bokee.net
Fri Mar 24 09:58:18 UTC 2006
now is ok.
I user Socket, direct connect.
yesterday i use jakarta-commons-net lib.
I'm a developer at www.bokee.net .
I want to use mogilefs as file storge system .
But our system developed by java, so I want have a java client.
public void test03() throws Exception{
String domain = "test";
String fileclass = "my01";
String filekey = "wuhao09";
Socket echoSocket = null;
PrintWriter out = null;
BufferedReader in = null;
try {
echoSocket = new Socket("192.168.0.122", 6001);
out = new PrintWriter(echoSocket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(
echoSocket.getInputStream()));
} catch (UnknownHostException e) {
System.err.println("Don't know about host: taranis.");
System.exit(1);
} catch (IOException e) {
System.err.println("Couldn't get I/O for "
+ "the connection to: taranis.");
System.exit(1);
}
BufferedReader stdIn = new BufferedReader(
new InputStreamReader(System.in));
String userInput;
{
out.println( Client.getOpenCmd(filekey));
String str1 = in.readLine();
log.debug(str1);
Map r = Client.parse(str1);
filePut((String) r.get("path"));
String cmd2 = Client.getCloseCmd(filekey, r);
log.debug(cmd2);
out.println(cmd2);
str1 = in.readLine();
log.debug(str1);
out.println(Client.getDomainsCmd());
str1 = in.readLine();
log.debug(str1);
String cmd4 = Client.getPathsCmd(filekey);
out.println(cmd4);
log.debug(cmd4);
str1 = in.readLine();
log.debug(str1);
out.println(Client.getHostsCmd());
str1 = in.readLine();
log.debug(str1);
out.println(Client.getDevicesCmd());
str1 = in.readLine();
log.debug(str1);
}
out.close();
in.close();
stdIn.close();
echoSocket.close();
}
ÒýÓÃ Justin Azoff <JAzoff at uamail.albany.edu>:
> wuhao at bokee.net wrote:
> > Hi:
> > I write a java test class. bu CREATE_CLOSE ses
> >
> > ERR unknown_command Unknown+server+command
> >
> > but a sent it by telnet
> > it's ok.
> >
> > my code:
>
> [...]
>
> > t.sendAYT(5 * 1000);
>
> What is this supposed to do?
>
> I'd recommend directly porting the structure of the perl/python/php
> clients. The php client is the simplest, but only does the bare minimum
> needed to work... It is a good starting point though.
>
>
> --
> -- Justin Azoff
> -- Network Performance Analyst
>
More information about the mogilefs
mailing list