-
AuthorPosts
-
AnonymousInactiveJune 20, 2008 at 1:54 amPost count: 23
I just received my EZSrve today, and it came with firmware 1.51.
I can connect to its web server on port 80 and do stuff. Cool.
However, I cannot connect to port 8002 (in order to send XML commands).
When I try from the command line (telnet my_ezsrve_ip 8002) it just hangs.
When I try with some Java code, sending the XML doesn’t fail, but it also hangs waiting for a response.
Nmap sees ports open on 21 and 80, but doesn’t say that 8002 is open (but I’m not sure if it normally scans that port or not).Suggestions???
David
AnonymousInactiveJune 20, 2008 at 2:22 amPost count: 408Take a look at the open source utility
http://sourceforge.net/projects/shnutilitysuite/
You need to create a TCP socket to 8002, and then send/receive text (XML).
The utility is windows only – if you are using another OS let me know your environment.
AnonymousInactiveJune 20, 2008 at 12:34 pmPost count: 23Paul:
Thanks for your quick response.
I had already downloaded that suite, but didn’t find much there that I could make heads or tails out of (I’m not a VB or .net guy). I ran FindEZBridge.exe out of curiosity and it worked (although I had already determined its IP from my router, and switched it to a static IP).
Ultimately I may use a Linux box to communicate with the EZSrve, but for the time being I’ll probably play using a Windows box. Once I get the socket code working (in Java), it shouldn’t matter which machine I use.
But back to the problem at hand… can you be a bit more specific about what in the SHN utility suite I need to use in order to enable the 8002 XML socket on the EZSrve?
David
AnonymousInactiveJune 20, 2008 at 7:01 pmPost count: 23Okay, I found “Simplehomenet Utility Suite.exe” and ran it.
I provided the IP address, it let me send a command, and it worked.
I disconnected, and then ran my Java program (simple test that calls GetVersion), and it worked, too.So what magic does the Utility Suite do to enable the listener on the EzSrve’s port 8002?
Will the listener stay there?
David
AnonymousInactiveJune 20, 2008 at 7:04 pmPost count: 408Can you send me your code? That will be the easiest way to see what’s missing.
AnonymousInactiveJune 20, 2008 at 7:19 pmPost count: 23Paul:
Here’s the “meat” of the code. It doesn’t deal with the blocking read very well – very crude code for starters, but I can send and receive commands.
David
public void go() {
try {
Socket sock = new Socket("172.16.0.30",8002);
PrintStream ps = new PrintStream(sock.getOutputStream());
String xmlPreamble="";
String request = xmlPreamble+"GetVersionn";
System.out.println("Request: "+request+"n");
System.out.println("Response:");
ps.print(request);
BufferedReader br = new BufferedReader(new InputStreamReader(sock.getInputStream()));
String line;
int c;
long milliseconds=5000;
long endTime = System.currentTimeMillis()+milliseconds;
c=br.read();
while (System.currentTimeMillis()=0) {
System.out.print((char)c);
c=br.read();
}
br.close();
ps.close();
sock.close();
} catch (Exception e) {
System.out.println(e);
}
}
AnonymousInactiveJune 20, 2008 at 7:22 pmPost count: 1001Can you post your Java code? Did the = new Socket(ezservipaddress,8002) fail before connecting with the Utility and it worked after? I would think EZSrve would have issued a = new ServerSocket(8002) when it came up or the Utility would not have connected.
Never mind. While I was looking up the Java calls I see Paul had asked for the code. SHN will get to the bottom of the problem.
AnonymousInactiveJune 20, 2008 at 9:28 pmPost count: 23I’ve upgraded to 1.52, apparently without issue.
After the upgrade (and presumed reboot of the EZSrve) my Java code stopped working.
I ran “Simplehomenet Utility Suite” again, hit “Connect”, then “Disconnect”, and exited.
Then I ran my Java code (just sends a GetRevision), and it worked (and reported 1.52).
As an additional experiment, I reset the EZSrve, and ran my Java code on my desktop machine. No response. Then, from my laptop, I ran the Utility Suite, hit Connect, then Disconnect, and exited.
Then I ran my Java code again from the desktop machine, and it worked – told me the version it was running (1.52), even though the Utility Suite was run from a different machine.It looks to me like the Utility Suite is doing something to the EZSrve that makes port 8002 “wake up” (that my Java code isn’t).
David
AnonymousInactiveJune 20, 2008 at 10:36 pmPost count: 1001Have you tried inserting println statements at various points to see exactly where the process stops. I’m assuming you are not seeing any message from the catch. Would be interesting to see how far the process gets when the Utility has not interfaced with EZSrve.
AnonymousInactiveJune 21, 2008 at 12:52 amPost count: 23The process stops with the read() – it never returns with any data (unless I’ve previously run the Utility Suite and done the connect/disconnect dance).
And no, it’s not throwing any exceptions (that the “catch” would catch).David
AnonymousInactiveJune 21, 2008 at 1:16 amPost count: 1001Thanks for that info. I downloaded the source for the utility but I don’t have a VB environment. I’ll look through the project files the hard way to see if I can find what else the utility does.
AnonymousInactiveJune 21, 2008 at 1:23 amPost count: 408I am reviewing your code this evening.
Also – Microsoft offers a free VB environment called express.
AnonymousInactiveJune 21, 2008 at 2:19 amPost count: 408Some minor tweaks
public static void main(String[] args) {
try {
Socket sock = new Socket("192.168.0.107",8002);
PrintStream ps = new PrintStream(sock.getOutputStream());
String request = "GetVersionn";
System.out.println("Request: "+request+"n");
System.out.println("Response:");
ps.println(request);
BufferedReader br = new BufferedReader(new InputStreamReader(sock.getInputStream()));
String line;
int c;
long milliseconds=5000;
long endTime = System.currentTimeMillis()+milliseconds;
c=br.read();
while (System.currentTimeMillis()<endTime) {
System.out.print((char)c);
c=br.read();
}
br.close();
ps.close();
sock.close();
} catch (Exception e) {
System.out.println(e);
}
}
This is working fine on my end. Let me know.
AnonymousInactiveJune 21, 2008 at 3:16 pmPost count: 1001If Paul’s changes have not solved your problem, try moving the creation of the BufferedReader object (br) before the point where you issue the actual GetVersion ps.print(request).
AnonymousInactiveJune 21, 2008 at 10:06 pmPost count: 23Paul:
No change for me. It worked when I tried it the first time. But after I reset the EZSrve (via web interface), your Java code didn’t work until after I ran the Utility Suite and did a connect and disconnect.
David
-
AuthorPosts
- You must be logged in to reply to this topic.