# Econet Support

BeebEm emulates an Econet network. This allows multiple instances of BeebEm to communicate with other. BeebEm also supports the AUN Econet protocols that enable BeebEm to communicate with other AUN compatible machines.

Econet support is enabled from the Hardware menu in BeebEm. Also switch off Freeze when inactive if you intend to run multiple instances of BeebEm so they can all run at the same time.

Each machine attached to an Econet has a station number (between 1 and 254) associated with it. An Econet may also have a file server attached to it (special station number 254).

BeebEm emulates an Econet using IP datagrams. Each station on the network needs a unique IP address and port number combination. Each instance of BeebEm needs to know the address and port number of the other instances on the network, this information is configured in the Econet.cfg and AUNMap files.

The default Econet.cfg file has been set up to enable AUN mode. Read the notes in the Econet.cfg and AUNMap files for more information on configuring AUN mode.

If you just want to run a few instances of BeebEm on a single PC then the simplest way to is to edit the Econet.cfg file and disable AUN mode (set AUNMODE to 0) and uncomment the example network configuration for IP addresses 127.0.0.1 (near the end of Econet.cfg). With this configured the first 5 instances of BeebEm run on a single PC will get allocated unique station and port numbers. The first instance will be allocated a station number 254 (file server) and next 4 will be allocated station numbers 101 to 104. See the notes in Econet.cfg for more details.

You can also specify the Econet.cfg and AUNMap file names on the command line, using the `-EconetCfg` and `-AUNMap` options. Refer to the command line options for more details.

## File Server

An Econet file server enables a disk file system to be shared by all of the stations on the network. Acorn produced various versions of file server software. The level 1 and 2 file server software is included in disk images with BeebEm. The server software must be run on station number 254.

To run the level 1 server, load the econet_level_1_utils.ssd disk image and run the file server by typing CH."FS".

You will be prompted for:

- Number of files per user - enter 3
- Manual configuration - enter Y
- Directory for first station - enter A
- Station number - enter 101
- Directory for second station - enter B
- Station number - enter 102
- Directory for third station - just press `Enter`

The file server will then start running and report that it is ready.

The level 2 server is a little more complicated to set up. It requires the 6502 second processor support to be enabled and requires a special "master" disk to be formatted (must be a double sided disk). I suggest you read the "The Econet Level 2 Fileserver Manager's Guide" (available at BBC Docs) if you want to set up a level 2 server.

To use the Econet file system from a station you will need to have a ROM installed that supports the Econet file system (such as the Acorn DNFS ROM installed in Model B mode). To switch a station into Econet file system mode press `N` + `F12`. The Econet station number should be shown on screen. To switch without pressing the break key type *NET. You can then use commands such as *CAT, LOAD, SAVE and CHAIN to access files on the server.

## Troubleshooting

The Econet emulation in BeebEm is not perfect and is susceptible to timing issues. When a message is being sent between stations BeebEm waits for a short time for the Econet to become free again before sending the next message. If the delay is too small messages can interfere with each other and cause a "Net Error" to be reported. If it is too long a station can report "Line Jammed". The waiting time is set by default to 100000 cycles (0.05s) but can be overridden by a command line option -EcoFF. If you see "Net Error" report try a -EcoFF 500000, for "Line Jammed" try -EcoFF 50000.

The emulation is also sensitive to the Econet scout ACK timeout value, controlled by the SCACKTIMEOUT (or SCOUTACKTIMEOUT) setting in Econet.cfg. Setting this value too low will cause Econet commands to fail, hang, or command output to contain garbage or blank lines.