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 & HelpOther Libraries › processing.net behind a firewall
Page Index Toggle Pages: 1
processing.net behind a firewall (Read 651 times)
processing.net behind a firewall
Aug 19th, 2008, 1:01pm
 
Does anyone have any tips for working with processing.net behind a firewall?
I'm following some of Tom Igoe's code from "Making Things Talk" which works fine at home, but coming up to school and its dreaded firewall, a client.ip() call reveals that I am indeed pulling a 69... IP address.

Is there any way of adding a proxy setting for this? I have to do this for most of my web apps to work.

cheers,

Doug Easterly

*update*
I don't think the 69.xx.xxx.xxx address has anything to do with it after all - but I still think there is a problem running the client object behind a firewall.

I just tried my code at home again (with the println.ip() function) and it does show an IP starting with 69. But, the following also shows up in my output window:
// output window
Transfer-Encoding: chunked
Date: Tue, 19 Aug 2008 21:55:07 GMT
Content-Type: text/html
Server: Apache/1.3.41 (Unix) mod_gzip/1.3.26.1a mod_log_bytes/1.2 mod_bwlimited/1.4 mod_auth_passthrough/1.8 FrontPage/5.0.2.2635 mod_ssl/2.8.31 OpenSSL/0.9.7a

Via: 1.1 nc3 (NetCache NetApp/6.0.5P1)
b  
2
// end output window

I wonder what the 'b' is? The number 2 is what I am trying to bring back to processing.
running the same code at school never achieves this return from the server.

if anyone has some advice on that it would be greatly appreciated.
Re: processing.net behind a firewall
Reply #1 - Aug 22nd, 2008, 12:48pm
 
Starting to get somewhere.

I modified the processing.net example by looking at some PHP examples I found on the Web. I don't know where this return in the output is coming from (it could be my own proxy server I suppose) but at least I am finally getting something when I run the sketch.

Code:

import processing.net.*;

Client c;
String data;

void setup() {
 size(200, 200);
 background(50);
 fill(200);
 c = new Client(this, "www.processing.org", 80); // Connect to server on port 80
//  c.write("GET / HTTP/1.1\n"); // Use the HTTP "GET" command to ask for a Web page
c.write("GET www.processing.org HTTP/1.0\r\nHost: yourProxyServer.com:8080\r\n\r\n");
//  c.write("Host: yourProxyServer.com:8080\r\n"); // Be polite and say who we are
}

void draw() {
 if (c.available() > 0) { // If there's incoming data from the client...
   data = c.readString(); // ...then grab it and print it
   println(data);
 }
}
/*
// the output window returns the following:
HTTP/1.1 401 Authorization Required
Content-Length: 1079
Keep-Alive: timeout-5, max=1000
Connection: Keep-Alive
Cache-Control: no-cache
Content-Type: text/html

<HTML><HEAD><TITLE>Firewall Authentication</TITLE></HEAD><BODY><FORM ACTION="/" method="POST"><INPUT TYPE="hidden" NAME="magic" VALUE="4tinet2093847"><TABLE ALIGN="CENTER" width=400 height=250 cellpadding=2 cellspacing=0 border=0 bgcolor="#008080"><TR><TD><TABLE border=0 cellpadding=0 cellspacing=0 bgcolor="#9dc8c6"><TR height=30 bgcolor="#008080"><TD><b><font size=2 face="Verdana" color="#ffffff">Authentication Required</font></b></TD></TR><TR><TD><TABLE border=0 cellpadding=5 cellspacing=0 width="320" align=center><TR><TD colspan=2><font size=2 face="Times New Roman">Please enter your username and password to continue.</font></TD></TR><TR><TD><font size=2 face="Times New Roman">Username:</font></TD><TD><INPUT TYPE="text" NAME="username" size=25></TD></TR><TR><TD><font size=2 face="Times New Roman">Password:</font></TD><TD><INPUT TYPE="password" NAME="password" size=25></TD></TR><TR><TD><INPUT TYPE="hidden" NAME="4Tredir" VALUE="www.processing.org"><INPUT TYPE="submit" VALUE="Continue"></TD></TR></TABLE></TD></TR></TABLE></TD></TR></TABLE></FORM></BODY></HTML>

*/
Re: processing.net behind a firewall
Reply #2 - Aug 22nd, 2008, 1:54pm
 
Fixed it!
for all the other newb's like me stuck behind a firewall:

Code:

import processing.net.*;

Client c;
String data;

void setup() {
size(200, 200);
background(50);
fill(200);
c = new Client(this, "yourProxyServer.com", 8080); // put your own proxy server and port # here
/* Put in the page you want to access after GET,
and while we are at it, put in the required Host parameter.
*/
c.write("GET http://www.processing.org HTTP/1.0\r\nHost: yourProxyServer.com:8080\r\n\r\n");
}

void draw() {
if (c.available() > 0) { // If there's incoming data from the client...
data = c.readString(); // ...then grab it and print it
println(data);
int newData = int(data);
println(data);

}
}
Page Index Toggle Pages: 1