S4 is implemented in nesC for TinyOS. The implementation can be run both in TOSSIM, a packet level sensor network simulator, and on real testbed of sensors. I. How to run S4 in TOSSIM: 1. go to S4/apps/TestS4Simple directory and compile using "make pc". 2. run it using "run.sh". It takes a small 100-node network, and simulates 1000 randomly-generated (src,dest) pairs of routing, one every second. The output contains information about the routing performance of each pair. 3. to play with it for larger-scale networks, first generate the topologies using LossyBuilder, then modify the correspondig parameters that specify numbers of nodes and beacons. II. How to run S4 on real sensors: 1. compile the code using "make mica2" (only tested on Mica2 motes). 2. upload binary code onto all sensors. 3. compile the java code in S4/java/net/tinyos/cr using "compile.sh". 4. start serialForwarder on all sensors with ethernet connection. 5. create a text file describing testbed map. An example is S4/eval/42map. The first line specifies number of gateways, i.e. sensors with ethernet connections. From the second line, each line specifies a mote. The third column is the id of the mote. The second column is the id of the closest gateway. (Note that, if all sensors are connected to the ethernet, this map file may not be necessary. The java programs need to be modified accordingly.) 6. run S4 using RoutingTest. It randomly chooses sources and destinations each second and routes a packet from a source to a destination. To log the routing statistics, only those sensors with ethernet connections can be chosen as end points of routing.