AI Zone Admin Forum Add your forum

NEWS: survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Cannot load default ChatScript bot on an EC2 instance

Hey guys,
I am relatively new to the whole chatbots thing, but so far I have been able to install ChatScript on an EC2 instance. but when I run this command:

./LinuxChatScript64 client=localhost:1024 

and runs as expected as it initiates a normal chatbot simulation in the ssh session.
However when I try it from a web browser it simply doesnt work!
I am using the Amazon AMI and also it doesn’t seem to let me add the cronjob as well.
What could I be doing wrong?


  [ # 1 ]

Hi Timothy

to run the cs-server from command line:

./LinuxChatScript64 port=1024

to run the client “tester” (from command line):

./LinuxChatScript64 client=localhost:1024

what you mean with “when try it from a web browser” ?



  [ # 2 ]

What I meant from a web browser is when I type my server’s DNS into the url bar, it loads the chat page as expected but does not load the bot when I fill out my username and message fields and sending it.


  [ # 3 ]

still not clear to me :-(
with “my server” do you mean a web frontend server ?

You have to implement in backend a tcp client that dialogate with ChatScript server. 

| web server |
| CS TCP client |
| CS engine server |


  [ # 4 ]

Well I think it would be easier for me to show you what I mean.
Here is the link for the CS on the EC2 instance:

However now that you have pointed that out to me I have a feeling that I have not set up the CS TCP client properly.


  [ # 5 ]

> However now that you have pointed that out to me I have a feeling that I have not set up the CS TCP client properly.

I think so. I feel it depends on ui.php PHP script (the CS-client) you call here:

function sendMessage(data)//Sends inputs to the ChatScript server, and returns the response-  data - a JSON string of input information
success: function(response){
error: function(xhrstatuserror){
('oops? Status = ' status ', error message = ' error "\nResponse = " xhr.responseText);

As an example of a client you can see my draft code (in Ruby) here:

In particular, take a look at the volley method:

BTW, CS wiki documentation:



  [ # 6 ]

Giorgio thank you for your responses so far, but I would like to ask a couple more questions as I am still a ChatScript newbie.

I had a look at the links that you posted earlier but I am still a little lost when it comes to installing it on my EC2 instance.
Does this get installed inside the existing ChatScript directory or on the instance alone?


  [ # 7 ]

Timothy, if you talking about the CS-client (I presume ui.php), you have to install it where it’s able to reach the CS-server, so maybe (but not necessarly) in the same place you installed the CS-server (the EC instance).

May you share the PHP code (chunk of) ?


  [ # 8 ]

Hi Giorgio,

This is what the code looks like in ui.php file right now (the one that I had found in the WEBINTERFACE/BETTER folder)

If this is not it, should I install the client in the WEBINTERFACE folder as well?

GNU nano 2.5.3                                                        Fileui.php                                                                                                                        


//  =============  user values ====
$port 1024;          // <<<<<<< your port number if different from 1024
$bot  "Harry";       // <<<<<<< desired botname, or "" for default bot

// Please do not change anything below this line.
$null "\x00";
$postVars filter_input_array(INPUT_POSTFILTER_SANITIZE_STRING);

if (isset(
// open client connection to TCP server
$userip = ($_SERVER['X_FORWARDED_FOR']) ? $_SERVER['X_FORWARDED_FOR'$_SERVER['REMOTE_ADDR']// get actual ip address of user as his id

$msg $userip.$null.$bot.$null.$message.$null;

// fifth parameter in fsockopen is timeout in seconds
('Error opening socket',E_USER_ERROR);

// write message to socket server
    while (!
.= fgets($fp512);

// close socket connection

  [ # 9 ]

i’m not a PHP developer, but this css-client script you quoted seems ok for me.

Please verify if

$host = “”;

is correct (= is the IP address where CS engine reside).

Maybe you can check is the server is reachable (from teh PHP script) with cli command nc (and giving three null character: ^@^@^@):



If your PHP script is located in the same host where is the cs-engine you can maybe say “localhost”:

$host = “”;

I hope this help



  [ # 10 ]

Ok just ran that command that you told me about and I ran it a number of times just to verify.
This is along the lines of what I got when I ran that command.

ncserver timeout (1024

What can I do to resolve this and where else could I go as I am beginning to feel that this is more of a networking issue.


  [ # 11 ]

yes Timothy, seems that server IP isn’t reachable from client,  or you specify the wrong server address. If both client and server are in the same host, try: nc localhost 1024


  [ # 12 ]

Giorgio, I tried running both commands again and got this as the response to the first one that you told me to do:

ncconnect to port 1024 (tcpfailedConnection timed out 

When I tried the second command that you said, won’t even process and just go to a new line.



  [ # 13 ]

it seems that you can’t reach the server address (from the client), or the server process is down.

1. try just to ping the host where cs-server is running:

$ ping

if you are able to ping the server, so:

2. verify that your cs-server is really up&running;, listening at port 1024

$ nmap

if your cs engine is alive you will see something like:

Starting Nmap 6.40 ( ) at 2017-04-04 07:01 CEST
Nmap scan report for ...............
Host is up (0.0000060s latency).
Not shown: 998 closed ports
22/tcp   open ssh
1024/tcp open kdm

BTW, generally speaking, for security reasons…, i’ts better that you do NOT publish (in forums, etc.) you public IP addresses/ports pair.


  [ # 14 ]

About posting the IP adress that was a mistake on my part and won’t happen in future.
I tried pinging the server address and it timed out on every attempt, what could be the cause I hightly doubt that this is a contributing factor but I am using the Amazon AMI and I was thinking that this could be handling network traffic differently when compared with any other OS?

Is there anything that I should do/review anything that is on the AWS control panel?

Also have there been any differences when running ChatScript on Ubuntu compared to Amazon AMI?


  [ # 15 ]

> About posting the IP adress that was a mistake on my part and won’t happen in future.

it’s just a general suggestion grin not a real issue.

I’m not practice with Amazom AWS and I’m not a big fan of (Amazon) cloud, sorry.

My suggestion is to test your fullstack web+client+server on your local (linux) host, in that case:

to check is cs-engine respond:

$ nc 1024

where ^@ means CTRL-SPACE

to send a message from user giorgio to the default running bot:

$  nc 1024

What is your first name?



 1 2 3 > 
1 of 3
  login or register to react