Crossbow advise the XServe data protocol is as follows:

PROTOCOL:

In both cases the data protocol is:
a) Receive four bytes -- these are the length of the subsequent data. The
four bytes will be in little-endian binary. Assume this number is N.
b) Receive N bytes from the socket -- this will be XML data in ASCII.
c) Goto step a.

They provided me with psedo code for how to develop a "middle" class for
talking to XServe:

This is pseudo code of how an application will talk to xserve (only in the
command and response case):

***********************************************************
//this is a string that is the xmlrcp method you wish to call
//there are packages for most programming languages at xmlrpc.org which

//can build this for you dynamically
String xmlMethod = “<method> …… </method>

//open a socket to xserve and its command port
Socket xserveSocket = openSocket(xserve_ip_addr, xserve_command_port)

//get the length of your xmlMethod as a byte array in little endian notation

int methodLength = xmlMethod.length();
ByteArray methodLengthAsBytes = methodLength.convertToLittleEndianBytes();

//write the length to the socket
xserveSocket.write(methodLengthAsBytes, 4);

//write the actual xmlrcp data
xserveSocket.write(xmlMethod, xmlMethod.length());

//wait for response (either a select, or event call, different based on
language)

//read in the first 4 bytes of the socket to determine how
//long the response is
xserveSocket.read(methodLengthAsBytes, 4);

//now read in xmlrpc respnose
String xmlrpcResponse = “”;
methodLength = methodLengthAsBytes.convertToInt();
xserveSocket.read(xmlrpcResponse,methodLength);


***********************************************************

I think my problem lies with Endian Byte conversion - I'm trying to actuate
a light on a MicaZ sensor using the XML method to do this, and Java Sockets.
Has anyone ever dealt with talking to XServe before?

Regards,
Dave.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to