Copy link to clipboard
Copied
Hi everyone, here is some problem I got in last few days:
I build a Socket Server (an .exe file, with C#) on a machine, Internet IP address, and PORT is also open in this machine;
I can connect to that server with C# and Windows Command line "telnet <IP> <PORT>".
but I can't connect to this server with ExtendScript Socket Object, socket error is: "cannot connect to <IP>:<PORT>".
And thanks for your replies..
Here is my ExtendScript code:
function connectToServer() {
var tcp = new Socket();
tcp.encoding = 'UTF-8';
try {
var a = tcp.open(SERVER_IP + ':' + SERVER_PORT, 'UTF-8');
if (!a) {
alertError('connect failed');
return null;
}
tcp.writeln('this is a connect test');
return tcp.read(99999999);
} catch (e) {
alertError(e);
} finally {
tcp.close();
}
return null;
}PS.
function alertError(msg) {
alert(msg,
ALERT_NAME,
true
);
}
Copy link to clipboard
Copied
Have you checked the "Allow scripts to write files and access the network" box in Edit>Preferences>Scripts and Expressions?
Copy link to clipboard
Copied
If you are using SSL, the sockets will not work with ExtendScript.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more