Connecting to the CogServer

From OpenCog
(Redirected from Connecting to the Cogserver)

The CogServer, by default, listens for telnet connections on port 17001. After starting the CogServer, use telnet to connect to it. From from a separate terminal window, run

telnet localhost 17001

Optionally, enable readline, which enables you to edit the shell's history run:

rlwrap telnet localhost 17001

This assumes that rlwrap is installed on your machine.

You should be presented with:

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
opencog>

Run "help"<enter> to get a list of commands. After additional modules are loaded, additional commands will appear.

Available commands:                                        
  help:           List the available commands or print the help for a  specific command
  list:           List atoms in the atomtable 
  listmodules:    List the currently loaded modules  
  loadmodule:     Load an opencog module
  py:             Enter the python shell 
  py-eval:        Run some python code  
  quit:           Close the shell connection 
  scm:            Enter the scheme shell
  sexpr:          Enter the s-expression shell
  shutdown:       Shut down the cogserver
  stats:          Print some diagnostic statistics about the server.
  unloadmodule:   Unload an opencog module                         


To get information about any of the commands, use "help <name of command>". For example

opencog> help scm                                                              
Usage: scm [hush|quiet|sync]                                                   
                                                                              
Enter the scheme interpreter shell. This shell provides a rich                 
and easy-to-use environment for creating, deleting and manipulating            
OpenCog atoms and truth values. It provides a full R5RS-compliant              
interactive scheme shell, based on the GNU Guile extension language.           
                                                                              
If 'hush' or 'quiet' is specified after the command, then the prompt           
will not be returned.  This is nice when catting large scripts using           
netcat, as it avoids printing garbage when the scripts work well.              
If 'sync' is specified after the command, then the output is sync,             
instead of async.