【发布时间】:2018-06-12 16:08:55
【问题描述】:
我完全绝望地尝试这样做。我开始了一份新工作,我得到了一个在 Processing 中制作的应用程序,现在我需要它来调用一个简单的 index.html(https://west-4f2bc.firebaseapp.com) 但不能在浏览器上打开它。
有什么办法吗? 稍后我将在 URL 中传递数据添加参数,但现在我只需要在没有打开窗口的情况下调用它。
请帮帮我..... 我尝试了很多此代码的变体
import processing.net.*;
Client myClient;
void setup() {
// Connect to the local machine at port 10002.
// This example will not run if you haven't
// previously started a server on this port.
myClient = new Client(this, "west-4f2bc.firebaseapp.com", 80);
// Say hello
myClient.write("GET /\r\n");
}
void draw() {
}
谢谢。
有了这个,我只得到真实的,所以它连接但我只得到 0。
import processing.net.*;
Client myClient;
int dataIn;
void setup() {
size(200, 200);
// Connect to the local machine at port 5204.
// This example will not run if you haven't
// previously started a server on this port.
myClient = new Client(this, "west-4f2bc.firebaseapp.com", 80);
println(myClient.active());
println(dataIn);
}
void draw() {
}
这样我就可以连接了,但是在 Client SocketException: Socket closed 之后
import processing.net.*;
Client myClient;
int dataIn;
void setup() {
Client client;
client = new Client(this, "west-4f2bc.firebaseapp.com", 80);
if (client.active()==true) {
println("connected");
// Make a HTTP request:
client.write("GET /call.html?id=ola&nome=artur\r\n");
client.write("\r\n");
client.stop();
} else {
// if you didn't get a connection to the server:
println("connection failed");
}
}
【问题讨论】:
标签: java firebase client-server processing