TCP connection in slow motion

I’ve always been curious about the netstat output: what is the meaning of the different TCP connection states? How the connection transit from a state to another? I am also working on a different post on TCP errors, so I need to understand better the different TCP connection phases.

I then decide to “film” a TCP connection between two computers in slow motion. The idea is to show how the state of the TCP connection changes in the two machines and what packets transit between the two hosts.

Setup

To perform the experiment I have used a laptop (thinkpad) and a raspberry pi (raspberrypi) connected through my home’s wifi network.

A server application runs on the thinkpad and listens on port 9090. The server is just a netcat in listening mode:

nc -l 9090

A client application runs on the rapsberrypi and connects to the server on the thinkpad. Again the client is a netcat instance:

nc 192.168.1.108 9090

Note that the server and the client applications run on top of a Linux OS. The operative system manages the TCP connection and offers to the applications primitives to listen for connection, accept incoming connections, create connection, send and receive data and finally close connections. In the post, I will refer to the server and the client both to indicate the application and/or the OS.

The packets between the client and the server are captured and visualized with Wireshark.

The connection status is monitored in both machines with a repeated netstat command with output filtered on port 9090 and visualization of the timers (-o flag):

watch -n 1 "netstat -nao | grep \"9090\|Proto Rec\""

To slow down the packets between the two machines I have used Traffic Control. Here the bash script that setups TC:

#!/bin/bash

interface=wlp5s0
port=9090
delay=3s

# clean all the queuing disciplines
sudo tc qdisc del dev $interface root

# adds a queuing discipline with id 1:0 to the outbound traffic (root/egress)
# the discipline is PRIO https://linux.die.net/man/8/tc-prio 
# the prio class is setup to send all the packets to band 0
sudo tc qdisc add dev $interface root handle 1:0 prio priomap 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

# adds a queuing discipline to the class 2 of the prio discipline we defined before
# the discipline with id 20:0 will use net emulator to delay packets
sudo tc qdisc add dev $interface parent 1:2 handle 20:0 netem delay $delay

# adds a filter to the class 0 of the prio discipline we defined before
# the classifier (u32) is a generic filter based on packet properties 
# the match is on packet with port $port
# the selected packets are sent to class 2 of the prio discipline
sudo tc filter add dev $interface parent 1:0 protocol ip u32 match ip sport $port 0xffff flowid 1:2
sudo tc filter add dev $interface parent 1:0 protocol ip u32 match ip dport $port 0xffff flowid 1:2

# To remove the delay
# sudo tc -p qdisc ls dev wlp5s0
# sudo tc qdisc del dev wlp5s0 root

Screen layout

Top left: Wireshark, all the packets between the two hosts will be visible there.

Top right: the TCP status diagram for both machines. The blue colour is used for the server, the red colour for the client. The green colour is used to indicate that both server and client are in the same state.

Bottom left – first console: the console that runs the server on the thinkpad machine.

Bottom left – second console: the connection status for the server. A repeated run of the netstat command on the thinkpad machine.

Bottom right – first console: the console that runs the client on the raspberrypi machine.

Bottom right – second console: the connection status for the client. A repeated run of the netstat command on the rapsberrypi machine.

Storyline

Server and client are not running. Both side of the connection are in state CLOSED (there is no connection).

The server application is launched and starts listening on port 9090. The connection on the server side is now in status LISTEN. Netstat shows a process listening on port 9090. No packets exchanged or activity on the client side.

TCP connection establishment

The client application is launched and initiates a connection toward the server. The client sends a SYN packet: the 3-way handshake has begun. The connection status on the client side is now SYN_SENT.

The server receives the SYN packet and moves to status SYN_RECEIVED. The server then sends back a SYN-ACK packet.

The client receives the SYN-ACK packet and moves the connection status to ESTABLISHED. The client sends back an ACK packet.

The server receives the ACK packet and moves the connection status to ESTABLISHED.

The server application has been notified of the presence of the incoming connection and will manage it in a separate thread. At this point, there are two sockets open on the server side: one listing for new connections and another for the established connection to the client.

The 3-way handshake is now completed and the connection established.

In the Wireshark screen, you can notice some packets visualized in light grey, those are packets that have been re-sent because an ack was not received in time (packets delayed by traffic controller).

Data communication

The server sends a “Hello” message to the client. The client receives it, print it in the console and sends back an ACK packet.

The client sends a “Bye” message to the server. The server receives it, print it in the console and sends back an ACK packet.

Notice the flag PSH, it indicates that the received data should be pushed to the application.

TCP connection termination

The connection can be terminated by the server or by the client, in this case, the server initializes the process.

The server application is terminated, this indicates to the OS that the socket can be closed. The server sends a FIN packet to the client and sets its connection status to FIN_WAIT1. The four-way handshake has begun.

The client receives the FIN packet, sets the connection status to CLOSE_WAIT and sends back an ACK packet.

The server receives the ACK packet from the client and moves to FIN_WAIT2.

The client process is terminated and the connection can be closed. The client sends a FIN packet to the server.

The server receives the FIN packet and replies with the last ACK packet moving to TIME_WAIT status. This status is used to receive and discard packets that have been delayed in the network.

The client receives the last ACK and closes the connection.

The server waits for the timer to expire and then closes the connection.

The TCP connection is now terminated.

Video

Finally the video. Please watch it at the highest resolution.

DLP LightCrafter Display 2000 EVM and BeagleBoneBlack first setup

In this article we will make a first setup of our BeagleBoneBlack and our DLP LightCrafter Display 2000 EVM.

 

 

 

 

BeagleBoneBlack O.S. setup

In order to use the DLP with the BeagleBoneBlack we need to get the last Debian O.S. available for such board. The last version is provided both with the correct capes configuration and with a set of useful Python scripts to test the DLP.

You can download a nightly or weekly build from this site. For my setup I’ve downloaded the Stretch version (Debian 9) for SD card and with lxqt desktop.

After you’ve downloaded the image you can write it in your SD card using Etcher or your preferred image writer.

BeagleBoneBlack hardware setup

Simply plug the DLP module in the BBB. I suggest to use the provided screw in order to keep the BBB board raised and stable.

If you power the BBB board through the USB cable the DLP will not be powered. I’ve used a PSU to power both the BBB and the DLP board through the respective power jack.

We will use the USB cable just to connect the board to the PC.

First boot

When you power the BBB board you will see the user leds blinking. If you’re using Windows the board will be recognized and the drivers installed automatically.

The DLP will bootup, a green led will turn on and a default splash screen will be shown:

Project the BBB screen

We can tell to the BBB to send the Desktop screen to the DLP. To do so we need to connect to the BBB board using SSH. You can use any SSH client, on Windows you can use Putty.

Open your client and connect to the address 192.168.7.2, this is the default address used by the BBB board when connected through the USB cable, and port 22. When prompt digit the user debian and the password temppwd.

You will get the following output:

login as: debian
debian@192.168.7.2's password:
Linux beaglebone 4.9.40-ti-r52 #1 SMP PREEMPT Sat Jul 29 23:29:29 UTC 2017 armv7                                                                                        l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
debian@beaglebone:~$

Now we can write the following two commands:
i2cset -y 2 0x1b 0x0b 0x00 0x00 0x00 0x00 i
i2cset -y 2 0x1b 0x0c 0x00 0x00 0x00 0x1b i

Those commands will instruct the DLP board to take as input source the video sent by the BBB board through the Parallel Interface and to use a resolution of 640×360 (nHD landascape).

Here the result:

 

 

Flash Espruino on ESP8266-01 board

Here some instruction on how to flash the Espruino system in the ESP8266-01 board using a USB-TTL adapter.

Wiring

In order to flash the ESP8266-01 with Espruino we need to put the ESP in flash mode. To put the ESP in flash mode we need to pull-up gpio2, and pull down gpio0.

The EPS8266-01 pinout:

Image source: https://www.myelectronicslab.com/

Then the schema used to put the ESP in flash mode when connected to a FT232 adapter:

A summary of the connections:

ESP8266-01          FT232/PL2303
VCC         -->     VCC
GND         -->     GND
TX          -->     RX
RX          -->     TX
GPIO_0  -> 2.2KΩ -> GND
CHPD    -> 10KΩ  -> VCC

Flashing

To flash Espruino simply run this command:

esptool.py --port /dev/ttyUSB0 --baud 115200 \
  write_flash --flash_freq 40m --flash_mode qio --flash_size 4m \
  0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin \
  0x7C000 esp_init_data_default.bin 0x7E000 blank.bin

You should get the following output:
esptool.py --port /dev/ttyUSB0 --baud 115200   write_flash --flash_freq 40m --flash_mode qio --flash_size 4m   0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin   0x7C000 esp_init_data_default.bin 0x7E000 blank.bin
WARNING: Flash size arguments in megabits like '4m' are deprecated.
Please use the equivalent size '512KB'.
Megabit arguments may be removed in a future release.
esptool.py v2.0.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Compressed 3856 bytes to 2762...
Wrote 3856 bytes (2762 compressed) at 0x00000000 in 0.3 seconds (effective 123.2 kbit/s)...
Hash of data verified.
Compressed 461252 bytes to 323363...
Wrote 461252 bytes (323363 compressed) at 0x00001000 in 29.1 seconds (effective 126.8 kbit/s)...
Hash of data verified.
Compressed 128 bytes to 75...
Wrote 128 bytes (75 compressed) at 0x0007c000 in 0.0 seconds (effective 85.8 kbit/s)...
Hash of data verified.
Compressed 4096 bytes to 26...
Wrote 4096 bytes (26 compressed) at 0x0007e000 in 0.0 seconds (effective 3093.4 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...

First connection

In order to run in normal mode we need to change the connection schema:

I had some trouble connecting the ESP8266-01 for the first time to the Espruino IDE. I was able to connect to it using a standard serial software but no way with the IDE.

I’ve then installed the Espruino Tools and uploaded a first sample application that makes the ESP connect to the WiFi.

 espruino -p /dev/ttyUSB0 -b 115200 sample.js

And here the sample.js code:
function connectWiFi() {
  var wifi = require("Wifi");  
  wifi.connect("***WIFI*SSID***", {password:"***WIFI*PASSWORD***"}, 
    function(details) {
      console.log('details: ', details);
      wifi.save();
    }
  );
}

function onInit() {
  connectWiFi();
}

save();

After the sample upload I was able to connect to my ESP using the Espruino IDE.

Internal/External temperature sensor with two ESP8266 boards and Espruino

In this article we will use two ESP8266 board to show internal and external temperature in an OLED screen using Espruino and some JavaScript code.

 

 

 

 

The internal board will:

  • read the temperature and humidity from a DHT22 sensor
  • receive the external temperature and pressure from the external ESP board
  • show all the information in the OLED screen

The external board will:

  • read the temperature and barometric pressure from a BMP085 sensor
  • send the temperature and the pressure to the internal board using a WiFi connection

In this article we will reuse the wiring and the code we wrote in the previous articles about the ESP8266 board.

Wiring

The internal board is wired to the DHT22 sensor and the OLED screen:

The external board will be connected to the BMP085 sensor:

Internal board code

The internal board gets the internal temperature using the DHT22 sensor and print it in the OLED screen. The board prints also the external board information, we keep such information in an externalData variable.

var dht = require("DHT22").connect(NodeMCU.D4);
var g;

var externalData;

function drawData(temperature, humidity) {
  g.clear();
  g.setColor(5);

  g.drawString("INT", 0, 2);
  g.drawString("T: " + temperature + " C", 0, 20);
  g.drawString("H: " + humidity + " %", 0, 40);

  g.drawString("EXT", 62, 2);

  if (externalData) {
    g.drawString("T: " + externalData.temperature.toFixed(2) + " C", 62, 20);
    var pressureInBar = externalData.pressure / 100000;
    g.drawString("P: " + pressureInBar.toFixed(2) + " bar", 62, 40);
  } else {
    g.drawString("N/A", 62, 20);
  }

  g.flip();
}

function readTemperature() {
  dht.read(function (info) {
    drawData(info.temp, info.rh);
  });
}

function setupGraphics() {
  require("Font8x12").add(Graphics);
  g.setFont8x12();
  g.drawString("Ready", 2, 2);
  g.flip();

  setInterval(readTemperature, 2000);
}

function setupOLED() {
  I2C1.setup({scl:NodeMCU.D1, sda:NodeMCU.D2});
  g = require("SSD1306").connect(I2C1, setupGraphics);
}

But how the externalData variable get updated? Through a socket server that listen for new connection on port 1234. When a connection is established the server read the sent data.
var wifi = require("Wifi");

function handleClient(socket) {
  socket.on('data', function(data) {
    console.log('external data: ', data);
    externalData = JSON.parse(data);
    socket.end();
  });
}

function setupServer() {
  var net = require("net");
  var server = net.createServer(handleClient);
  server.listen(1234);
}

function connectWiFi() {
  wifi.connect("***WIFI*SSID***", {password:"***WIFI*PASSWORD***"}, 
    setupServer
  );
}

function onInit() {
  setupOLED();
  connectWiFi();
}

save();

The complete code is available as attachment. Time to setup the external board.

External board code

The external board reads the temperature and the barometric pressure from the BMP085 sensor and send it to the internal board using a TCP connection.

var bmp;

function setupBmpSensor() {
  I2C1.setup({scl:NodeMCU.D1, sda:NodeMCU.D2});
  bmp = require("BMP085").connect(I2C1);
}

var wifi = require("Wifi");

function sendDataToServer(data) {
  var net = require("net");
  net.connect({host: "192.168.1.105", port: 1234}, function(socket){
    var json = JSON.stringify(data);
    socket.end(json);
  });
}

function getAndSendData() {
  bmp.getPressure(sendDataToServer);
}

function setupDataPolling() {
  setInterval(getAndSendData, 2000);
}

function connectWiFi() {
  wifi.connect(
    "***WIFI*SSID***", 
    {password:"***WIFI*PASSWORD***"}, 
    setupDataPolling
  );
}

function onInit() {
  setupBmpSensor();
  connectWiFi();
}

save();

The result

 

How to make two ESP8266 communicate through WiFi with Espruino and JavaScript

In this article we will make two ESP8266 communicate using the WiFi network. We will use Espruino and some JavaScript code.

Setup the WiFi

Espruino offers a WiFi module that let us to connect to a WiFi network.

The code below will connect our ESP to the WiFi network and will print the information about the obtained IP plus other network information:

var wifi = require("Wifi");
wifi.connect("***WIFI*SSID***", {password:"***WIFI*PASSWORD***"}, function(err) {
  console.log("connected? err = ", err, " info = ", wifi.getIP());
});

The result should be:
 _____                 _
|   __|___ ___ ___ _ _|_|___ ___
|   __|_ -| . |  _| | | |   | . |
|_____|___|  _|_| |___|_|_|_|___|
          |_| http://espruino.com
 1v93 Copyright 2016 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
>
=undefined
connected? err =  null  info =  {
  "ip": "192.168.1.106",
  "netmask": "255.255.255.0",
  "gw": "192.168.1.1",
  "mac": "5c:cf:7f:f8:53:5a"
 }

Please take note of the IP for both the devices, currently there are no other way to discover each other.

Now both the devices are connected to the WiFi network. Now we can make them talk each other. In this example we elect one board server and the other client. The client board will start a TCP communication toward the server board. Once connected they will able to exchange messages.

Setup the server

The server first setup the WiFi connection, then creates a socket server on port 1234 for receiving connection from the clients. When a connection is established it will print the messages coming from the client and will close the connection saying “I’m a server! Goodbye.”.

function handleClient(socket) {
  console.log('client connected');

  socket.on('error', console.log);

  socket.on('data', function(d) {
    console.log('client says: ', d);
    socket.end("I'm a server! Goodbye.");
  });
}

function setupServer() {
  var net = require("net");
  var server = net.createServer(handleClient);
  server.listen(1234);
}

function connectWiFi() {
  var wifi = require("Wifi");

  wifi.connect("***WIFI*SSID***", {password:"***WIFI*PASSWORD***"}, function(err) {
    console.log("connected? err = ", err, " info = ", wifi.getIP());

    setupServer();
  });
}

function onInit() {
  connectWiFi();
}

save();

Setup the client

The client, after get ready with the WiFi connection, will try to connect to the server. When the connection is established it will send a “Hello I’m a client!” message and will wait for responses from the server.

function talkToServer(socket) {
  console.log('connected to the server');

  socket.on('error', console.log);

  socket.on('data', function(d) {
    console.log('server says: ', d);
  });

  socket.on('end', function() {
    console.log('disconnected from the server');
  });

  socket.write('Hello, I\'m a client!');
}

function connectToServer() {
  var net = require("net");
  net.connect({host: "192.168.1.105", port: 1234}, talkToServer);
}

function connectWiFi() {
  var wifi = require("Wifi");

  wifi.connect("***WIFI*SSID***", {password:"***WIFI*PASSWORD***"}, function(err) {
    console.log("connected? err = ", err, " info = ", wifi.getIP());

    connectToServer();
  });
}

function onInit() {
  connectWiFi();
}

save();

The output

Here the output in the server side:

>
 _____                 _
|   __|___ ___ ___ _ _|_|___ ___
|   __|_ -| . |  _| | | |   | . |
|_____|___|  _|_| |___|_|_|_|___|
          |_| http://espruino.com
 1v93 Copyright 2016 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
>Erasing Flash..................
Writing.....
Compressed 25600 bytes to 2137
Checking...
DRunning onInit()...
connected? err =  null  info =  {
  "ip": "192.168.1.105",
  "netmask": "255.255.255.0",
  "gw": "192.168.1.1",
  "mac": "5c:cf:7f:0f:7a:2b"
 }
client connected
client says:  Hello, I'm a client!
>

Here the output for the client side:
>
 _____                 _
|   __|___ ___ ___ _ _|_|___ ___
|   __|_ -| . |  _| | | |   | . |
|_____|___|  _|_| |___|_|_|_|___|
          |_| http://espruino.com
 1v93 Copyright 2016 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
>
=undefined
Erasing Flash..................
Writing.....
Compressed 25600 bytes to 2352
Checking...
DRunning onInit()...
connected? err =  null  info =  {
  "ip": "192.168.1.104",
  "netmask": "255.255.255.0",
  "gw": "192.168.1.1",
  "mac": "5c:cf:7f:f8:53:5a"
 }
connected to the server
server says:  I'm a server! Goodbye.
disconnected from the server
>

Reading pressure and temperature from a BMP085 using an ESP8266 board and Espruino

In this short tutorial we will read the barometric pressure from the BMP085 sensor using an ESP8266 board and Espruino with some Javascript code.

Wiring

Our BMP085 sensor communicates through an I2C connection, so we need to connect the SCL pin to the corresponding D1 pin and the SDA pin to the corresponding D2 pin in the ESP board. The other two pins are dedicated to the power.

Code

To read both pressure and temperature we will use the BMP085 module of Espruino. After the I2C connection is setup we initialize the BMP085 module, then we start polling and printing the sensor information.

I2C1.setup({scl:NodeMCU.D1, sda:NodeMCU.D2});
var bmp = require("BMP085").connect(I2C1);

function readPressure() {
  bmp.getPressure(function(info) {
    console.log("Pressure: " + info.pressure + " Pa");
    console.log("Temperature: " + info.temperature + " C");
  });
}

setInterval(readPressure, 2000);

Here the result:

Showing temperature in a OLED display using Espruino and an ESP8266 board

In this short article I will show you how to read the temperature and the relative humidity from a DHT22 sensor and display it in a 128×64 OLED display using an ESP8266 board with Espruino and JavaScript running on it.

Wiring

The DHT22 has 4 pins, only three used: two for the power and one for the data. We will connect the power pins to the corresponding pins on the ESP8266 board and the data pin to one of the GPIO pin, D7 in our schema.

The display is a SSD1306 with a resolution of 128×64 pixels and I2C communication. The display has four pins, two for the power and two for the I2C. We connect the I2C pin to the corresponding D1 e D2 pins in the ESP8266 board.

Code

Espruino provides a module for reading the temperature and the relative humidity from a DHT22 sensor. We will use it to read both the values from the connected sensor.

Then we will use the I2C module combined to the SSD1306 module to show the collected information in the display.

We will poll the sensor every 2 seconds and update the display consequently.

var dht = require("DHT22").connect(NodeMCU.D7);

function drawData(temperature, humidity) {
  g.clear();
  g.drawString("T: " + temperature + " C", 2, 2);
  g.drawString("H: " + humidity, 2, 20);
  g.flip();
}

function readTemperature() {
  dht.read(function (info) {
    drawData(info.temp, info.rh);
  });
}

function setupGraphics() {
  require("Font8x16").add(Graphics);
  g.setFont8x16();
  g.drawString("Ready", 2, 2);
  g.flip();

  setInterval(readTemperature, 2000);
}

I2C1.setup({scl:NodeMCU.D1, sda:NodeMCU.D2});
var g = require("SSD1306").connect(I2C1, setupGraphics);

save();

The final result:

How to install Espruino firmware in an ESP8266 board

espruino_logo

This is an update to the installation tutorial I’ve already wrote: Run JavaScript on your ESP8266 using Espruino firmware

For this installation I’m using a D1 mini board which is a “wrapper” for the ESP8266 (ESP-12) board.

Flash the Espruino firmware

The first step is to flash the Espruino firmware into the ESP board. You can find a tutorial in the Espruino site. In this article I’m putting a short list of instructions ready to use.

Install the ESP tools with the following command:

pip install esptool

The ESP tools are a set of Python scripts necessary to flash a firmware in the ESP board.

We need now the last version of the Espruino firmware, you can get it from the download page of the Espruino site. The zip file will contain the Espruino firmware also for the ESP8266 board.

We are ready to flash our board. The following instruction are for a ESP-12 board connected to the /dev/ttyUSB0 port. Please refer to the original tutorial for a different version of the ESP board. First move to the folder where you have unzipped the firmware.

cd espruino_1v93_esp8266_4mb
esptool.py --port /dev/ttyUSB0 --baud 115200 \
  write_flash --flash_freq 80m --flash_mode qio --flash_size 32m \
  0x0000 "boot_v1.5.bin" 0x1000 espruino_esp8266_user1.bin \
  0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin

The blue led in the board will start blinking and you will see the following output in console:
WARNING: Flash size arguments in megabits like '32m' are deprecated.
Please use the equivalent size '4MB'.
Megabit arguments may be removed in a future release.
esptool.py v2.0.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash params set to 0x004f
Compressed 3856 bytes to 2763...
Wrote 3856 bytes (2763 compressed) at 0x00000000 in 0.2 seconds (effective 124.0 kbit/s)...
Hash of data verified.
Compressed 479796 bytes to 336471...
Wrote 479796 bytes (336471 compressed) at 0x00001000 in 29.7 seconds (effective 129.3 kbit/s)...
Hash of data verified.
Compressed 128 bytes to 75...
Wrote 128 bytes (75 compressed) at 0x003fc000 in 0.0 seconds (effective 86.3 kbit/s)...
Hash of data verified.
Compressed 4096 bytes to 26...
Wrote 4096 bytes (26 compressed) at 0x003fe000 in 0.0 seconds (effective 4737.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...

If you’re having problems finding the correct device path in Linux:

  • first check that you’re using an USB data cable. The first time I’ve tried I was getting crazy because I was using a simple power USB cable.
  • second try this console command to print the system events when the USB cable is plugged:
    watch -n 0.1 "dmesg | tail -n $((LINES-6))"

    When you plug the cable you will get something like this:
    [ 5597.132098] usb 6-1: new full-speed USB device number 11 using uhci_hcd
    [ 5597.298148] usb 6-1: New USB device found, idVendor=10c4, idProduct=ea60
    [ 5597.298156] usb 6-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [ 5597.298160] usb 6-1: Product: CP2102 USB to UART Bridge Controller
    [ 5597.298163] usb 6-1: Manufacturer: Silicon Labs
    [ 5597.298165] usb 6-1: SerialNumber: 0001
    [ 5597.304121] cp210x 6-1:1.0: cp210x converter detected
    [ 5597.306173] usb 6-1: cp210x converter now attached to ttyUSB0

Ready to run

After the flash operation the board is ready to receive your JavaScript commands!

To send the commands you need to connect to the board using a serial connection (through the USB port). Under linux you can use the screen program:

screen /dev/ttyUSB0 115200

Now you can send JavaScript commands that will be interpreted and the output provided as response.

For example writing:

1+1

you will get:
=2

You can call functions, for example:
reset();

it will reset the board and print a boot message:
 _____                 _ 
|   __|___ ___ ___ _ _|_|___ ___ 
|   __|_ -| . |  _| | | |   | . |
|_____|___|  _|_| |___|_|_|_|___|
          |_| http://espruino.com
 1v93 Copyright 2016 G.Williams

Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016

If you want to exit from Screen press CTRL-A and then \.

Now you’re ready to write your JavaScript code and run it in a ESP8266 board, for example using the Espruino Web IDE.