i'm trying to implement a telnet interface in a Processing sketch, to pass command and receive outputs on the console. I'm learning those days about the VT100 set of commands, so i was finally able to understand how was possible to reprint on already printed strings by moving the cursor.
I saw that it is also possible for the program to get input from the console, like with the Get cursor position command.
myClient.write("\033]6n"); //^[6n
The problem is that just print on the client interface the position, while i would like to have it back on the host. Someone know if and how is this possible?
Thank you
Here some example code:
import processing.net.*;
Server myServer;
void setup() {
myServer = new Server(this, 10002); // Starts a myServer on port 10002
}
void draw() {
Client thisClient = myServer.available();
if (thisClient != null) {
if (thisClient.available() > 0) {
String recived = thisClient.readString();
println(recived);
thisClient.write("\033[2A\r\033[2K" + "You just wrote: " + recived + "\033[2K");
thisClient.write("\033[6n"); // this happear on the client side, i want it back somehow
}
}
}
void serverEvent(Server someServer, Client someClient) {
someClient.write("\nhello, type something please...\n");
}