AI Zone Admin Forum Add your forum

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

Perl client talking to the Chatscript Server has puzzling timeouts
 
 

I’m trying to get a working ChatScript client written in Perl, to run on Ubuntu (on a Mac).
The ChatScript server is running on a remote Ubuntu machine in a server farm in Texas.

I don’t do anything fancy.  I open a socket to the remote server on port 1024,  send my concatenated three null-terminated string, read the reply,  close the socket, and loop.

If I run the ChatScript executable with client=<host>:1024,  it works fine, from Ubuntu.

But when I try to run my Perl client,  it only “sort of works”.  The progression of the dialog is correct, but it typically takes two or three or four tries to get what I say to “take”, as I’m getting back the error messages related to connection threads not hooking up with main-threads.
(“Sorry, I got distracted, what did you say? Sorry phone, what did yousay? Sorry Salesan at door, what did you say” type messages.)

Then it “takes” on the next try. 

If I send my responses very rapidly, as in “hello” repeatedly,  I get back a successful “I don’t know what to say” without intervening “sorry” messages.  It’s like the “timeout” is half a second or something.

In fact, it is only a second or less before I get the “sorry” message.

I’ve tried launching the server with “time=3000” as a command line parameter, and it has no effect, meaning I STILL get the “sorry” message back in about a second or less when I type something.

I’m using this:

      ./LinuxChatScript32 time=3000

Any ideas what I’m doing wrong? It’s probably very simple.  (code attached).

File Attachments
chatclient.rtf  (File Size: 2KB - Downloads: 117)
 

 
  [ # 1 ]

Additional info:

My question might be a “no brainer” to people who use sockets all the time, which isn’t me.
I’m thinking one of the parameters below may be what I need to set, and if YOU know what the ChatScript executable is doing, I’m hoping you can share !

  The machine the server is running on is my own (rented) virtual machine, with no one else using it, and I’m not running other applications on it.  In any case, the server seems to be functioning correctly since the ChatScript client can access it and chat with it.

That seems to imply that my opening a socket and using it is operating differently in some way than the way the ChatScript client opens and uses the socket.

I can’t read the source code in C well enough to know what parameters are being set or sent by the ChatScript client when it opens the Socket, and I suspect there is some default parameter I need to set in opening the socket that I’m failing to set, (or Perl is failing to set)  but that the ChatScript client is setting.  ( I can’t find any references to such parameters, if any,  in the server manual).

The paramters I can set are described here:
http://search.cpan.org/~gbarr/IO-1.25/lib/IO/Socket/INET.pm

and I’m suspecting one of the timeout or reuse settings may be what I need.

Here’s the list from that link:

In addition to the key-value pairs accepted by IO::Socket, IO::Socket::INET provides.

  PeerAddr   Remote host address       <hostname>[:]
  PeerHost   Synonym for PeerAddr
  PeerPort   Remote port or service     <service>[(<no>)] | <no>
  LocalAddr   Local host bind address     hostname[:port]
  LocalHost   Synonym for LocalAddr
  LocalPort   Local host bind port       <service>[(<no>)] | <no>
  Proto       Protocol name (or number)  “tcp” | “udp” | ...

  Type     Socket type             SOCK_STREAM | SOCK_DGRAM | ...
  Listen     Queue size for listen

  ReuseAddr   Set SO_REUSEADDR before binding
  Reuse       Set SO_REUSEADDR before binding (deprecated, prefer ReuseAddr)
  ReusePort   Set SO_REUSEPORT before binding

  Broadcast   Set SO_BROADCAST before binding
  Timeout   Timeout value for various operations

  MultiHomed Try all addresses for multi-homed hosts
  Blocking   Determine if connection will be blocking mode

—- end of list—

Wade

 

 
  [ # 2 ]

I posted the solution in Chatscript forum.

 

 
  login or register to react