App/Xtn/Browser/TCP Server
From XOWA: the free, open-source, offline wiki application
XOWA can function as a basic TCP server. The primary purpose of the server is to support a Firefox addon. However, the functionality may be expanded in future releases.
Note that XOWA uses two ports for communications: an inbound port (defaults to 55000) and an outbound port (defaults to 55001). This may change in later implementations.
Test setup [edit]
- Run xowa in server mode
-
java -jar /xowa/xowa_linux.jar --root_dir /xowa/ --app_mode server --server_port_recv 55000 --server_port_send 55001
- Run xowa_tcp_console located in /xowa/bin/any/java/xowa/tcp_console/
-
java -jar /xowa/bin/any/java/xowa/tcp_console/xowa_tcp_console.jar 55000 55001 simple.wikipedia.org 1000
- Enter "Earth". The 1st 1000 characters of the wikitext for Earth will display on the console.
Server notes [edit]
There are three arguments related to server mode
-
--app_mode server
-
This will launch XOWA in server mode. It will continue to run until either
- Control-C is pressed
- It receives a command of "app.server.stop;"
-
--server_port_recv 55000
- This specifies port 55000 as the port where XOWA will listen for messages. Clients will send messages to this port
-
--server_port_send 55001
- This specifies port 55001 as the port where XOWA will send messages. Clients will listen for responses on this port
Console notes [edit]
There are four arguments related to the console app
-
55000
- This specifies port 55000 as the port where the client will send its messages
-
55001
- This specifies port 55001 as the port where the client will listen for responses
-
simple.wikipedia.org
- This specifies the wiki that will be used for page lookup
-
1000
- This specifies the maximum number of characters to be returned
After starting, the console takes 4 possible inputs:
- <any page name>
-
- the page name is sent to the XOWA server
- the XOWA server will return the wikitext for that page
-
|server_exit
- stops the server
-
|exit
- stops the console
- Ctrl+C
- stops the console