Chapter 12. Networking

breve supports two kinds of networking: sending objects over the network from one simulation to another, and interacting with running breve simulations using a web browser.

This chapter starts by describing how to create a NetworkServer object which is used for both of these networking features (the section called “Starting a Network Server”). Next, sending and receiving breve objects over the network is described (the section called “Sending and Receiving breve Objects”). The final section describes how to allow the control of a breve simulation via a web interface (the section called “Using a Web-interface to a breve Simulation”).

Starting a Network Server

To start a network server, make a new instance of the class NetworkServer. The NetworkServer class is used for both receiving objects from other breve simulations, and for allowing a web interface to your breve simulation.

Once the NetworkServer instance has been created, it should be told to start listening for connections using the method listen. The listen method expects a port number which must be greater than 1024, but otherwise may be any unused port that both the client and the server breve users have agreed to.