aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes Querying Raspberry Pi Server through XML API (ZigBee Gateway) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Querying Raspberry Pi Server through XML API (ZigBee Gateway)" Watch "Querying Raspberry Pi Server through XML API (ZigBee Gateway)" New topic
Author

Querying Raspberry Pi Server through XML API (ZigBee Gateway)

Henry Sellers
Greenhorn

Joined: Jan 16, 2013
Posts: 1
Hi guys,

I'm using a Raspberry Pi as ZigBee Gateway and I have an API from Smartenit which has simple XML queries which are not working for me...it worked yesterday but now......!

The port and IP address are definitely correct...any ideas please?!

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class SimpleSocketServer {

@SuppressWarnings("resource")
public static void main(String args[]) throws Exception {

ServerSocket serverSocket;
int portNumber = 50333;
Socket socket = new Socket("192.168.1.27", portNumber);
String str;

str = "<zbpPacket>";
str += "<Object>ZBP_System</Object>";
str += "<methodName>Sys_Authenticate</methodName>";
str += "<Arguments>";
str += "<Argument type='string'>Smartenit</Argument>";
str += "</Argument>";
str += "</Arguments>";
str += "</zbpPacket>";

System.out.println(str);
serverSocket = new ServerSocket(portNumber);

System.out.println("Waiting for a connection on " + portNumber);

socket = serverSocket.accept();

InputStreamReader isr = new InputStreamReader(socket.getInputStream());
BufferedReader in = new BufferedReader(isr);

String line = "";
while ((line = in.readLine()) != null) {
System.out.println(line);
}


in.close();
isr.close();
socket.close();

}

}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Querying Raspberry Pi Server through XML API (ZigBee Gateway)