Connecting to the Cogserver

From OpenCog
Jump to: navigation, search

The CogServer, by default, listens for telnet connections on port 17001. After Starting cogserver, to connect to it run from a separate terminal window

telnet localhost 17001

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

rlwrap telnet localhost 17001

which 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. If the list of commands is shorter than the one shown below, some of the modules may not have been loaded due to changes in opencog-configuration-file or the modules may have been deprecated.

Available commands:                                                                             
  agents-active:      List running agents                                                       
  agents-list:        List available agents                                                     
  agents-start:       Start some agents                                                         
  agents-start-loop:  Start the agent loop                                                      
  agents-step:        Run a single cycle of an agent(s)                                         
  agents-stop:        Stop some agents running                                                  
  agents-stop-loop:   Stop the agent loop                                                       
  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                                                    
  loadpy:             Load commands and MindAgents from a python module                         
  py:                 Enter the python shell                                                    
  py-eval:            Run some python code                                                      
  pyshell.shell:      OpenCog IPython Shell                                                     
  quit:               Close the shell connection                                                
  scm:                Enter the scheme shell                                                    
  shutdown:           Shut down the cogserver                                                   
  sleep:              Sleep for the number of given seconds (default: 5 seconds)                
  sql-close:          Close the SQL database                                                    
  sql-load:           Load contents of SQL database                                             
  sql-open:           Open connection to SQL storage                                            
  sql-store:          Save the atomtable on the SQL database                                    
  unloadmodule:       Unload an opencog module                                                  
  zmq-close:          Close the ZeroMQ persistence                                              
  zmq-load:           Load contents of ZeroMQ persistence                                       
  zmq-open:           Open connection to ZeroMQ persistence                                     
  zmq-store:          Save the atomtable on the ZeroMQ persistence                              

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

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.