BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

E SSL_connect(): socket closed by peer [SOLVED]

Hello,

I have a MacBook Pro and an android phone and I have been trying to use blynk to control an arduino project over serial usb. I follow all directions found here

http://docs.blynk.cc/#hardware-set-ups-arduino-over-usb-no-shield

but when I type my serial port into terminal it connects but then it immediately says “socket closed by peer”.

Jeffrey-Thogmartins-MacBook-Pro:~ jeffthogmartin$ cd /Users/jeffthogmartin/Documents/Arduino/libraries/Blynk/scripts
Jeffrey-Thogmartins-MacBook-Pro:scripts jeffthogmartin$ ./blynk-ser.sh -c /dev/cu.usbmodem411 -b 9600 -s blynk-cloud.com -p 8442
Resetting device /dev/cu.usbmodem411…
[ Press Ctrl+C to exit ]
Connecting: GOPEN:/dev/cu.usbmodem411,raw,echo=0,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,crtscts=0 <-> openssl-connect:blynk-cloud.com:8442,cafile=/Users/jeffthogmartin/Documents/Arduino/libraries/Blynk/scripts/certs/server.crt,nodelay
2017/02/26 19:23:50 socat[20282] N opening character device “/dev/cu.usbmodem411” for reading and writing
2017/02/26 19:23:50 socat[20282] N opening connection to LEN=16 AF=2 45.55.96.146:8442
2017/02/26 19:23:50 socat[20282] N successfully connected from local address LEN=16 AF=2 192.168.0.18:57268
2017/02/26 19:23:50 socat[20282] E SSL_connect(): socket closed by peer
2017/02/26 19:23:50 socat[20282] N exit(1)
Reconnecting in 3s…

Can anyone help? I am in a little over my head with this but I have been trying desperately to get it to work. I have tried googling what socket closed by peer means and trying all the fixes for that but nothing is seeming to work. I feel like a firewall or something may be blocking the connection to the server, so i turned my firewall off and it still didn’t work. I don’t know If my guesses are even close to being the actual problem. Please Help!!! and Thank you in advance.

-Jeff

Did you enter your Blynk token in the Arduino sketch?

From a web browser what do you get if you enter your token in this url

http://blynk-cloud.com/YOUR_TOKEN_HERE/project

Looks like you are attempting an SSL connection on the wrong port.

TCP 8442
SSL 8441

A search of your error found this older but possibly still relevant solution…

Costas,

This is what the page shows when I type in that url…

{“id”:1,“name”:“Mood Lamp”,“createdAt”:1488141234361,“updatedAt”:1488224889762,“widgets”:[{“type”:“SLIDER”,“id”:1,“x”:0,“y”:0,“color”:-750560001,“width”:4,“height”:1,“tabId”:0,“label”:“Red Led”,“deviceId”:0,“pinType”:“DIGITAL”,“pin”:9,“pwmMode”:true,“rangeMappingOn”:false,“min”:0,“max”:255,“value”:“0”,“sendOnReleaseOn”:false},{“type”:“SLIDER”,“id”:2,“x”:0,“y”:2,“color”:600084223,“width”:4,“height”:1,“tabId”:0,“label”:“Green LED”,“deviceId”:0,“pinType”:“DIGITAL”,“pin”:10,“pwmMode”:true,“rangeMappingOn”:false,“min”:0,“max”:255,“value”:“0”,“sendOnReleaseOn”:false},{“type”:“SLIDER”,“id”:3,“x”:0,“y”:4,“color”:1602017535,“width”:4,“height”:1,“tabId”:0,“label”:“Blue LED”,“deviceId”:0,“pinType”:“DIGITAL”,“pin”:11,“pwmMode”:true,“rangeMappingOn”:false,“min”:0,“max”:255,“value”:“0”,“sendOnReleaseOn”:false}],“devices”:[{“id”:0,“name”:“Mood Lamp”,“boardType”:“Arduino UNO”,“token”:“6d16f01745634d04b421aa2c8a69283d”,“connectionType”:“USB”,“status”:“OFFLINE”,“disconnectTime”:1488224619376,“lastLoggedIP”:“99.236.80.243”}],“theme”:“Blynk”,“keepScreenOn”:false,“isAppConnectedOn”:false,“isShared”:false,“isActive”:true,“hardwareInfo”:{“version”:“0.4.3”,“boardType”:“Arduino Uno”,“cpuType”:“ATmega328P”,“connectionType”:“Stream”,“buildDate”:“Feb 27 2017 16:09:14”,“heartbeatInterval”:10}}

Restarted the computer and it worked! Weird…

Did you install socat and forget to reboot?

ummm yes i guess so! Haha… thanks for your help!