stops after three telent connections

I have a simple Console program that I’d like to connect to periodically using ‘telnet localhost 6571’ from a ssh session. Only trouble is, is that after connecting and disconnecting 3 times, no longer starts without resetting the MCU on the Yun.

Does anyone have any suggestions or recommendations, and, or, has anyone else run into this.

 *  To see the Console, pick your Yún's name and IP address in the Port menu
 *  then open the Port Monitor. You can also see it by opening a terminal window
 *  and typing:
 *  ssh root@ yourYunsName.local 'telnet localhost 6571'
 *  then pressing enter. When prompted for the password, enter it.
#include <Console.h>

void setup() {

  // Initialize Console:


void loop() {
  // put your main code here, to run repeatedly:

    static long waitPeriod = millis();
    if (millis() >= waitPeriod)
        // test for running?, start if needed.
        if (!Console) Console.begin();  

        // if we have a connection update the status page
            Console.println("*** Status Update ***");
        waitPeriod = millis() + 5000; // rerun this code to update Terminal in another 50ms time.

if I take out the code block:

// test for running?, start if needed.
        if (!Console) Console.begin();

telnet fails to reconnect after the first disconnect.

root@mhm002:/tmp# telnet localhost 6571
telnet: can't connect to remote host ( Connection refused

Eventually I’d plan to display values from sensors, but if I can’t get past this…


I noticed this in the bridge error log after a failure to reconnect:

root@mhm002:/tmp# cat
Traceback (most recent call last):
File “”, line 87, in
res = pr.process()
File “/usr/lib/python2.7/bridge/”, line 123, in process
File “”, line 49, in run
File “/usr/lib/python2.7/bridge/”, line 60, in run
File “/usr/lib/python2.7/bridge/”, line 78, in socket_receive
chunk = client.recv(1024)
socket.error: [Errno 131] Connection reset by peer

@cfo215, have you resolved your issue? Jesse

I had the same error, and found your post.

In /usr/lib/python2.7/bridge/ I edited line 78 which was indicated in the logs above to: -

      chunk = client.recv(1024)
      chunk = ''

This solved the problem for me, though I didn't look for the wider issue, so the solution may not be ideal. There might be a better place to catch the expression earlier in the stack.