We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › UnknownHostException
Page Index Toggle Pages: 1
UnknownHostException (Read 835 times)
UnknownHostException
Nov 28th, 2005, 3:04pm
 

g = "http://images.google.fi/images?hl=fi&q=dsc00908.jpg%20filetype%3Ajpg&btnG=Google-haku&sa=N&tab=wi";
google = new Client(this, g, 80);

This gives an UnknownHostException. What's wrong?
Re: UnknownHostException
Reply #1 - Nov 28th, 2005, 3:18pm
 
Nevermind. Figured it out.
Re: UnknownHostException
Reply #2 - Nov 28th, 2005, 3:29pm
 
try this.
make sure no spaces in your strings!

Code:

import processing.net.*;


Client client;

void setup() {

String myHost = "images.google.fi";
String myUri = "/images?hl=fi&q=dsc00908.jpg%20filetype%3Ajpg&btnG=";
myUri += "Google-haku&sa=N&tab=wi";

// Open a TCP socket to the host:
client = new Client(this, myHost, 80);
println("trying to fetch from "+myHost);
// Send the HTTP GET request:
client.write("GET "+myUri+" HTTP/1.1\n");
client.write("HOST: "+myHost+"\n\n");
}

void draw() {

if(client.available()>0) {
int inByte = client.read();
print((char)inByte);
}
}


andi
Page Index Toggle Pages: 1