Differing behavior from browser and java client program?
June 12, 2007 11:18 AM
Subscribe
I'm writing a little test program just to try out network programming in Java. However, some pages I GET from return the correct page, some return the standard 404 page (even when I can access the page from my browser), and some just hang without returning at all (again, from a page I can look at with my browser). Can someone more knowledgeable about network programming than me explain this?
Basically, I'm confused about why certain pages produce certain behavior in the program when I try to connect to them: all I'm doing is creating/opening a socket to a website, getting index.html, and printing the contents to stdout. Should be simple right? For some pages, it is: the html ouputs to the console like it should. However, for other pages, attempting to read index.html causes my program to just hang until the connection resets, or I get a 404 back instead of the page (the html of the 404 pages is output to the console). I'm pretty confused about both of these behaviors, since I can access the domains and index.htmls just fine through a browser. Why is this happening?
posted by version control to computers & internet (10 comments total)
"just hang until the connection resets" could just be the webserver waiting for proper header syntax...
posted by bhance at 11:22 AM on June 12, 2007