NunoACHenriques <nach@xxxxxxxxxx> writes: > Hi! > > Where can I find documentation about the Script-fu-server protocol? You have to read the source code. > Sorry if this is an off-topic post but I couldn't find the Protocol > anywhere and my problem is: > > I run the gimp-script-fu-server (Gimp 1.2.1 for Linux) and I have a C > program that opens a TCP socket to it (port 10008). I get connected but when > I send a simple command like "(set! x)" the server shutdown the socket?!... > :-( What am I doing wrong? Here's a Java program I wrote that talks to the server: It reads lines from stdin and sends them to the server. import java.io.*; import java.net.*; public class GimpClient { public static void main(String args[]) throws IOException { Socket sock; DataInputStream dis; PrintStream dat; byte[] header = new byte[2]; byte[] reply = new byte[99]; InputStreamReader is = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(is); sock = new Socket("localhost",10008); dis = new DataInputStream(sock.getInputStream()); dat = new PrintStream( sock.getOutputStream()); for(;;){ String myline = br.readLine(); if (myline == null) break; header[0] = (byte) (myline.length()>>8); header[1] = (byte) (myline.length() % 256); dat.print("G"+new String(header)+myline); dat.flush(); int len = dis.read(reply); for (int i = 0; i < len; i++){ System.out.print((char)reply[i]); } System.out.println(); } sock.close(); } }