LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-03-2005, 01:21 AM   #1
Ynot Irucrem
Member
 
Registered: Apr 2005
Location: Perth, Western Australia
Distribution: Debian
Posts: 233

Rep: Reputation: 30
java can't read from some websites


I've got a program that checks a website's md5 hash against a stored hash and tells if the website has changed or not since the last check. it works fine for most sites that I've tried, but some sites give this error:
Code:
E:\tafe\progs and docs\java\Assignment>java UsePage http://www.google.com proxy.thornlietafe.wa.edu.au:8080
Old hash:

java.net.SocketException: Unexpected end of file from server
        at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
        at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
        at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
        at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
        at sun.net.http://www.protocol.http.HttpURLConn...getInputStream(Unknown Source)
        at java.net.URL.openStream(Unknown Source)
        at Page.hasChanged(Page_0.4.java:68)
        at UsePage.main(UsePage_0.2.5.java:36)
I used tracert to get the ip of the machine
Code:
E:\tafe\progs and docs\java\Assignment>tracert www.google.com

Tracing route to www.l.google.com [64.233.189.104]
over a maximum of 30 hops:

  1  192.168.20.220  reports: Destination net unreachable.

Trace complete.
then I tried with the IP:
Code:
E:\tafe\progs and docs\java\Assignment>java UsePage http://64.233.189.104/ proxy
.thornlietafe.wa.edu.au:8080
Old hash:


Page has changed:
true

New hash:
0facbdb9fcef9833adb02a45a7664edf
and it works. I think it might be something to do with redirection. I'm still learning java, so I don't know if you have to do something to make it work with redirection. also i'm pretty stupid, so it probably has nothing to do with redirection.

the class uses the URL class to read the site, it sets the proxy system properties (http.proxyPort and http.proxyHost).

this may look like homework. the original project was homework but I've already done what we were supposed to do and am trying to make it better. the original project was to make Page.class, and UsePage.class was just to test it, but I want to make UsePage.class into a full-blown CLI.

I looked up Java.net.SocketException on the java site, but the description (Thrown to indicate that there is an error in the underlying protocol, such as a TCP error.) wasn't very helpful.

thanks.

EDIT: I didn't choose to use windoze, it's the only thing on these TAFE computers.

Last edited by Ynot Irucrem; 06-04-2005 at 09:08 AM.
 
Old 06-04-2005, 06:43 AM   #2
atom
Member
 
Registered: Feb 2004
Location: Slovenia
Distribution: archlinux
Posts: 271

Rep: Reputation: 31
www.google.com has a spooled adress, that is, with multiple IP's. Maybe that's what's bothering your code. Try it with some adresses that are definitely not spooled, like some local website or a friend's site and see if it works. I can't think of anything else at the moment, and i'm not the guy to ask for java, but I'd guess that's what's troubling you.
 
Old 06-04-2005, 09:13 AM   #3
Ynot Irucrem
Member
 
Registered: Apr 2005
Location: Perth, Western Australia
Distribution: Debian
Posts: 233

Original Poster
Rep: Reputation: 30
Thanks for replying.

I've just done some more tests and it appears that there may be problem(s) with my Page class, which I thought was watertight, so I'm sorry to say that I have to leave this thread unanswered, because any help with my Page class would constitute cheating in mine and this forum's eyes.

Last edited by Ynot Irucrem; 06-04-2005 at 10:17 AM.
 
Old 06-04-2005, 06:42 PM   #4
atom
Member
 
Registered: Feb 2004
Location: Slovenia
Distribution: archlinux
Posts: 271

Rep: Reputation: 31
Best of luck!
We can still wish you
Till you start to cluck
of all the difficulty the page class shall give you

And then you will turn
for help and inspiration
and these forums will still burn
with desire for salvation

of problems everlasting
that every programmer has
when writing watertight classes
and then one small mistake forgetting.

Ok this is bad poetry I just had to get it out of my system... Have fun with writing the class and, best of luck
 
Old 06-05-2005, 02:04 AM   #5
Ynot Irucrem
Member
 
Registered: Apr 2005
Location: Perth, Western Australia
Distribution: Debian
Posts: 233

Original Poster
Rep: Reputation: 30
Thanks for that. Get it out of your system? Do you regularly get a sudden urge to do poetry?
 
Old 06-05-2005, 04:28 AM   #6
atom
Member
 
Registered: Feb 2004
Location: Slovenia
Distribution: archlinux
Posts: 271

Rep: Reputation: 31
Yeah, quite regularly. Especially during my Slovene lessons (I'm from slovenia, so this is mother-tongue) and the teacher's a dead bore. Some of them were written during Geography (geography genesis, for one .. I the beginning, there was mrs. Radoman. And mrs. Radoman was at Geography and Geography was mrs. Radoman. and She said: let there be light. And my schoolmate turned on the lights. And for a while, it was good ). Some of them become quite good punk songs... My electric guitar seems to get much use when school's boring, but not at other times... Figures

Most of my poetry's really good from the technical stand-point: I write 6 line 8 sillable yamb or amphibrach (i hope I spelled that correctly) AABBCC or AABBAA rhymes. And most of it's in english, so I might post some here (not that anyone would care for some stupid fun-making poetry of some lunatic guy who thinks he can program just because he won the national championchip in programming, but can't figure out what's wrong with a bash-script for hours at a time... oh, and then he writes poetry )

Hope my babble wasn't too boring


Gasper
 
Old 06-05-2005, 08:29 AM   #7
Ynot Irucrem
Member
 
Registered: Apr 2005
Location: Perth, Western Australia
Distribution: Debian
Posts: 233

Original Poster
Rep: Reputation: 30
I always meant to learn guitar but never actually did anything. I really should try to learn.

nah not really boring, just very humbling - national programming championships, knows guitar, poetry, speaks another language... damn I suck.

just looked over your posts - what the hell is with all the smileys?
 
Old 06-05-2005, 09:02 AM   #8
atom
Member
 
Registered: Feb 2004
Location: Slovenia
Distribution: archlinux
Posts: 271

Rep: Reputation: 31
Oh, the smileys

It's just, whenever I write I laugh at my own stupidity all the time, so I subconciously try to show that (there should be a smiley here instead of the dot ).

I dunno, the old shift+; D rutine has sunk into my fingers so badly that I can't stop writing ČD whenever I'm on a Slovenian keyboard. U know, talking to Slovenian friends and ther're constantly getting some weir ČD's all over the place.

I don't know why I laugh at myself all the time, I just basicly think I'm funny (I think that I think that I think that I think I'm funny but I'm not sure I think I am and I'm not sure if others think I am). I guess that I am because every performance I have at our school improvisational league (again, nation wide thing) the cowd is roaring with laughter. (Yay I can make stupid faces like a goddamn pro! Dave Chapell, you're a loser, I can beat the crap out of you on stage... um... no, you're still a lot funnier than me... I'm a lousy standup comedian.)

And there's no way you should feel humbeled. Why I know a foreign language is a simple matter of the size of our country. It's 20.000 square kilometers all in all, and it's got a sheep's dick-long less than 2 million inhabitants, one third of that being retired ppl, and if you get around a *wee bit* more than I do you'll end up knowing half the population your age. If we don't learn foreign lanugages (btw, they're a compulsory part of the curriculum, I'm learing English and German, learned French for a year and didn't like it much + I know Serbo-Croatian (the language of our southern neighbors, very similar to Slovene)), we'd be stuck in this god-forsaken country between Italia, Austria, Hungary and Croatia for the rest of our goddamn lives. Now see where I live, on the net, speaking English on a daily basis (I use about the same ammount of English than Slovenian, and I read a lot more English than I do Slovenian (mostly tech stuff, and I can't go past LOTR and Star Wars: The New Jedi Order series, + Discworld series by Terry Pratchet, thank you Terry, you da man ). Again, all the *national* stuff I do is like, there's a school level of competition, area level of competition, and national level of competition. Now considering there's like 3 guys in our school including me (800 students in the whole highschool, which is like one of the best in Slovenia) and we're all the same team, there's no use setting up a school level, so we go directly to area level, if there was one. In our capital, there's lots of competition but count all the other places in Slovenia in and you have like a 120 ppl on the competition, most of them being incompetent assholes who know a little pascal (you of course are a c++ fan and when they turn down your object-oriented approach you are left with pure c, stdio.h and the like). Perfect.<sarcasm> *really hard* to win, stuff like this </sarcasm>

Guitar's been my almost best friend since a long time, no stuff here...

Poetry I have explained above... If I gave you some of my poetry you would probably laugh your pants off, it's not serious, except for some poems that I write at English, for English, in English, and get an 5 (translated into American grade system == A)

Oh, and I'm crap at finishing stuff. I've got a shitload of programming projects open (some commertial!) but I can't bring myself to finishing them. I program while it's innovative (search engine stuff, encryption, experimental sorting algorythms, compression algorythms), but when I have to program stuff for GUI or even worse, routine index.html's, I back out. No way, I'm not doing this, it's BORING, it's work for Aljo (one of my friends who is a crap programmer but knows some HTML and php and can do basic stuff, is a good designer though). It's my curse.

Oh, and notice I didn't use a lot of smileys, (means I was serious as hell and started thinking a little more than the 10% of my top-thinking abilities). I'm gonna go read sth now, you go and feel humble if you feel like it, but my advice would be to start doing what you like because all the stuff that I know helps me squat. Nada. ZERO.

And please, don't have me for a slavic guy from a poor country that's gonna take my job some of these days. It's not like that. We have all the technology you have (same manufacturer too!). We also have broadband internet. And cable TV My room turned on completely consumes a good 1200W of electricity (580 computer, the other goes for the lightning, 100W guitar amplifier and the HIFI amplifier, router, ISDN telephone station and the like). And please, don't say that you didn't take me for a damn slavic guy and all that crap because I know you didn't, just don't do so now, please . We are all well suited for the environment we were born in. Oh, and I do have a GF, before you ask .

How's your life?


Gasper
 
Old 06-06-2005, 03:26 AM   #9
Ynot Irucrem
Member
 
Registered: Apr 2005
Location: Perth, Western Australia
Distribution: Debian
Posts: 233

Original Poster
Rep: Reputation: 30
Quote:
talking to Slovenian friends and ther're constantly getting some weir ČD's all over the place.
haha lol

Quote:
laugh your pants off
hmm... I don't know about you, but when I laugh, there's nothing moving that could shake my pants loose.

musical instruments - ahhh...... had to play recorder for primary school - only thing I can remember is hot cross buns. Played "Joy to the World" (it was on The Simpsons the night before) once on my nonna's (Italian grandmother) keyboard, by pressing keys to figure out what the note sounded like. oh... sometimes I tap my foot/fingers to the beat of songs... does that count? Oh yeah.. I was in the quoir in year 5 and 6. I think that's it.

Quote:
take me for a damn slavic guy
I don't know what a "damn slavic guy" is supposed to be like. All I know about Slovenia is what I just googled up - something about Yugoslavia, population, area, climate etc.

Quote:
I do have a GF
damnit, where's the jealousy/humbled smily? this guy will have to do:

I know little bits and pieces of various languages, but nothing completely. I know bits of Java, C++, Bash, Perl, Visual Basic (ugh.. not my fault.. I had to do it for school), PHP, JavaScript. Haven't learned any GUI programming.. well, except VB of course, but that doesn't count.

Speaking Languages - bits of Japanese (School), German (mostly from listening to Rammstein), Italian (Italian family, and school).

Ugh.. I absolutely sucked at poetry in English. I hate English - I'm more mathematically/scientifically minded.

heh... Just remembered what got me into linux in the first place - this guy in my class was talking about how crap windows was and one of these days he was going to check out linux, so I did. he never ended up trying linux. he was a compulsive bull-shitter.

The End.

Anthony.
 
Old 06-06-2005, 04:36 AM   #10
atom
Member
 
Registered: Feb 2004
Location: Slovenia
Distribution: archlinux
Posts: 271

Rep: Reputation: 31
Laugh your pants off is an expression, commonly used in some particular branch of English literature that I enjoy very much.

You beat me at the quantity of programming languages you can use. My start was VB, then I started c++, decided it was quite useless for ordinary purposes, and went to php. By the time I moved to linux, so I was forced to learn bash (gentoo rulez in this aspect) and now I use bash A LOT. PHP's probably gonna be my job someday (I like the lang very much, especially version 5), oh, and I do know some javascript and java, but just when I dissassembled some applets to see how they worked and changed them to do my bidding (various "learn to hack" webistes... finished them all, nice target practice, no actual usability, just killing time.) Perl's been avoiding me for some time, and so has python, although I think they will continue to do that because, currently, I need them not. Never learned any GUI programming (except VB and XHTML/PHP/CSS symbiosis), but that, as said, doesn't count.

Have a nice life

Gasper
 
Old 06-07-2005, 10:27 PM   #11
Ynot Irucrem
Member
 
Registered: Apr 2005
Location: Perth, Western Australia
Distribution: Debian
Posts: 233

Original Poster
Rep: Reputation: 30
you too.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Java->Help me read it! alaios Programming 2 05-10-2004 12:15 PM
read file (Java) heellllpppp alaios Programming 4 05-07-2004 09:23 AM
can't read from file in java alaios Programming 2 04-24-2004 05:34 AM
Linux won't read Java VM want limewire CONWON Linux - Newbie 5 09-05-2003 09:20 PM
Using Java in Linux--Please Read! lazybum Linux - Software 4 07-19-2003 09:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration