Hosting a Blynk Server on local machine

Hey Guys

I’m trying to install the local server on my mac. When i started it, it seems like successful:

skanyal-mac-0:Downloads skanyal$ java -jar server-0.41.15-java8.jar -dataFolder .

Blynk Server 0.41.16-SNAPSHOT successfully started.
All server output is stored in folder ‘/Users/skanyal/Downloads/logs’ file.
Admin password not specified. Random password generated.
Your Admin url is https://192.168.0.107:9443/admin
Your Admin login email is admin@blynk.cc
Your Admin password is JibJOmbElu1NrNW9OppxynYw

I can open & login into the admin url using the localhost machine but when i’m trying to open the admin page from a different machine (in the same subnet), localserver sends a FIN (Saw on wireshark) after establishing the tcp connection.

Also when I try to connect the blynk app to the X.X.X.X:8080, it says “Cannot connect to server, try later”. Here also when i checked wireshark traces, the localsever sends FIN (Attaching the traces - 192.168.0.107 is the server & 192.168.0.137 is the blynkApp)

9 2021-02-28 18:29:29.488539 192.168.0.137 192.168.0.107 TCP 74 43998 → 8080 [SYN] Seq=0 Win=65535 Len=0 MSS=1460 SACK_PERM=1 TSval=1394613644 TSecr=0 WS=512
10 2021-02-28 18:29:29.488976 192.168.0.107 192.168.0.137 TCP 78 8080 → 43998 [SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1460 WS=64 TSval=1000074975 TSecr=1394613644 SACK_PERM=1
11 2021-02-28 18:29:29.493000 192.168.0.137 192.168.0.107 TCP 66 43998 → 8080 [ACK] Seq=1 Ack=1 Win=88064 Len=0 TSval=1394613713 TSecr=1000074975
12 2021-02-28 18:29:29.493162 192.168.0.107 192.168.0.137 TCP 66 [TCP Window Update] 8080 → 43998 [ACK] Seq=1 Ack=1 Win=131712 Len=0 TSval=1000074979 TSecr=1394613713
13 2021-02-28 18:29:29.497439 192.168.0.137 192.168.0.107 TCP 204 43998 → 8080 [PSH, ACK] Seq=1 Ack=1 Win=88064 Len=138 TSval=1394613717 TSecr=1000074975
14 2021-02-28 18:29:29.497600 192.168.0.107 192.168.0.137 TCP 66 8080 → 43998 [ACK] Seq=1 Ack=139 Win=131584 Len=0 TSval=1000074983 TSecr=1394613717
15 2021-02-28 18:29:29.498988 192.168.0.107 192.168.0.137 TCP 66 8080 → 43998 [FIN, ACK] Seq=1 Ack=139 Win=131584 Len=0 TSval=1000074984 TSecr=1394613717
16 2021-02-28 18:29:29.504813 192.168.0.137 192.168.0.107 TCP 66 43998 → 8080 [ACK] Seq=139 Ack=2 Win=88064 Len=0 TSval=1394613724 TSecr=1000074984
17 2021-02-28 18:29:29.504818 192.168.0.137 192.168.0.107 TCP 66 43998 → 8080 [FIN, ACK] Seq=139 Ack=2 Win=88064 Len=0 TSval=1394613724 TSecr=1000074984
18 2021-02-28 18:29:29.504978 192.168.0.107 192.168.0.137 TCP 66 8080 → 43998 [ACK] Seq=2 Ack=140 Win=131584 Len=0 TSval=1000074989 TSecr=1394613724

Java Version:

skanyal-mac-0:Desktop skanyal$ java -version
java version “1.8.0_201”
Java™ SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot™ 64-Bit Server VM (build 25.201-b09, mixed mode)

Server Jar Version:

server-0.41.15-java8.jar

Could someone pls help me ? Looks like i’m missing something.

What do you have in your server.properties file, in particular the allowed.administrator.ips section?

Pete.

Sure. I configured it as 0.0.0.0/0. Below is the full server.config details i’m using:

initial.energy=100000
allow.reading.widget.without.active.app=false
user.message.quota.limit=100
logs.folder=./logs
user.dashboard.max.limit=100
lcd.strings.pool.size=6
server.ssl.key=
webhooks.response.size.limit=96
hardware.mqtt.port=8440
table.rows.pool.size=100
terminal.strings.pool.size=25
admin.email=admin@blynk.cc
admin.rootPath=/admin
user.widget.max.size.limit=20
listen.address=
blocking.processor.thread.pool.limit=6
stats.print.worker.period=60000
enable.db=false
force.port.80.for.csv=false
enable.raw.db.data.store=false
restore.host=blynk-cloud.com
csv.export.data.points.max=43200
restore=false
user.profile.max.size=256
allow.store.ip=true
allowed.administrator.ips=0.0.0.0/0
net.interface=eth
webhooks.frequency.user.quota.limit=1000
http.port=8080
web.request.max.size=524288
user.devices.limit=50
async.logger.ring.buffer.size=2048
user.tags.limit=100
server.ssl.key.pass=
admin.pass=admin
hard.socket.idle.timeout=10
product.name=Blynk
data.folder=blynkData
map.strings.pool.size=25
profile.save.worker.period=60000
https.port=9443
log.level=info
server.ssl.cert=
force.port.80.for.redirect=true
notifications.queue.limit=2000
notifications.frequency.user.quota.limit=5

shouldnt it actually be…

allowed.administrator.ips=0.0.0.0/0,::/0

??

Pete.

OK tried by putting ipv6 mask also. No luck yet ! I enabled the traces & tried two types of connection:

One connection i tried from Chrome to localserver websocket on 8080. I see below logs:

11:48:16.122 TRACE- HTTP connection detected.
11:48:16.148 TRACE- In http and websocket unificator handler.
11:48:16.156 TRACE- Initialized hardware websocket pipeline. [WSIdleStateHandler, HttpServerCodec, HttpServerKeepAlive, HttpObjectAggregator, WSChannelState, io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandshakeHandler, io.netty.handler.codec.http.websocketx.Utf8FrameValidator, WSWebSocketServerProtocolHandler, WSWebSocket, WSMessageDecoder, WSSocketWrapper, WSMessageEncoder, WSLogin, WSNotLogged, DefaultChannelPipeline$TailContext#0]
11:48:39.156 TRACE- State handler. Hardware timeout disconnect. Event : READER_IDLE. Closing.

Below are the wireshark traces - In frame 19 webbrowser sends GET request, but server doesn’t reply

 11 2021-03-01 06:41:56.722157    192.168.0.107         192.168.0.107         TCP      56     54954 → 8080 [FIN, ACK] Seq=1 Ack=1 Win=6379 Len=0 TSval=1006606198 TSecr=1006589347
 12 2021-03-01 06:41:56.722229    192.168.0.107         192.168.0.107         TCP      56     8080 → 54954 [ACK] Seq=1 Ack=2 Win=6371 Len=0 TSval=1006606198 TSecr=1006606198
 13 2021-03-01 06:41:56.722565    192.168.0.107         192.168.0.107         TCP      56     8080 → 54954 [FIN, ACK] Seq=1 Ack=2 Win=6371 Len=0 TSval=1006606198 TSecr=1006606198
 14 2021-03-01 06:41:56.722616    192.168.0.107         192.168.0.107         TCP      56     54954 → 8080 [ACK] Seq=2 Ack=2 Win=6379 Len=0 TSval=1006606198 TSecr=1006606198
 15 2021-03-01 06:41:56.739695    192.168.0.107         192.168.0.107         TCP      68     54958 → 8080 [SYN] Seq=0 Win=65535 Len=0 MSS=16344 WS=64 TSval=1006606215 TSecr=0 SACK_PERM=1
 16 2021-03-01 06:41:56.739931    192.168.0.107         192.168.0.107         TCP      68     8080 → 54958 [SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=16344 WS=64 TSval=1006606215 TSecr=1006606215 SACK_PERM=1
 17 2021-03-01 06:41:56.739963    192.168.0.107         192.168.0.107         TCP      56     54958 → 8080 [ACK] Seq=1 Ack=1 Win=408256 Len=0 TSval=1006606215 TSecr=1006606215
 18 2021-03-01 06:41:56.739980    192.168.0.107         192.168.0.107         TCP      56     [TCP Window Update] 8080 → 54958 [ACK] Seq=1 Ack=1 Win=408256 Len=0 TSval=1006606215 TSecr=1006606215
 19 2021-03-01 06:41:56.740256    192.168.0.107         192.168.0.107         HTTP     553    GET /websockets/ HTTP/1.1
 20 2021-03-01 06:41:56.740289    192.168.0.107         192.168.0.107         TCP      56     8080 → 54958 [ACK] Seq=1 Ack=498 Win=407744 Len=0 TSval=1006606215 TSecr=1006606215
 69 2021-03-01 06:42:19.745801    192.168.0.107         192.168.0.107         TCP      56     8080 → 54958 [FIN, ACK] Seq=1 Ack=498 Win=407744 Len=0 TSval=1006629087 TSecr=1006606215
 70 2021-03-01 06:42:19.745960    192.168.0.107         192.168.0.107         TCP      56     54958 → 8080 [ACK] Seq=498 Ack=2 Win=408256 Len=0 TSval=1006629087 TSecr=1006629087
 71 2021-03-01 06:42:19.746204    192.168.0.107         192.168.0.107         TCP      56     54958 → 8080 [FIN, ACK] Seq=498 Ack=2 Win=408256 Len=0 TSval=1006629087 TSecr=1006629087
 72 2021-03-01 06:42:19.746314    192.168.0.107         192.168.0.107         TCP      56     8080 → 54958 [ACK] Seq=2 Ack=499 Win=407744 Len=0 TSval=1006629087 TSecr=1006629087

Then i tried logging in from blynk app. I see below logs

11:49:38.337 TRACE- Blynk hardware plain protocol connection detected.
11:49:38.340 TRACE- Incoming id=769, command=UpdateProject, body='� p�I�fU��\R��$���ih�F�q#�+�,̩�/�0̨� �
����/5<�


11:49:38.341 DEBUG- Hardware not logged. /192.168.0.137:46084. Closing.
11:49:48.505 TRACE- Blynk hardware plain protocol connection detected.
�K��+�,̩�/�0̨� TRA�E- Incoming id=769, command=UpdateProject, body='��o�����d���:h�|n���s��V�O
����/5<�


11:49:48.507 DEBUG- Hardware not logged. /192.168.0.137:46086. Closing.
11:49:56.805 TRACE- Blynk hardware plain protocol connection detected.
11:49:56.806 TRACE- Incoming id=769, command=UpdateProject, body='���9��F����:�ɼPy$3O24I�<v:>U�+�,̩�/�0̨� �
����/5<�


11:49:56.806 DEBUG- Hardware not logged. /192.168.0.137:46088. Closing.
11:50:06.845 TRACE- Blynk hardware plain protocol connection detected.
11:50:06.846 TRACE- Incoming id=769, command=UpdateProject, body='�
!�]�~���9(��T�#[��D-�).�+�,̩�/�0̨� �
����/5<�

Phew. I uninstalled the app. Rebooted the phone & installed it. Blynk App can now connect to server. However, from web browser, i cant connect to 8080 port (Logs attached above). What Am i missing ?

You should be using port 9443 for that.

If you’re still having problems accessing the web portal from another machine then maybe look at antivirus/firewall settings.

Pete.

I use 8088 port instead of 8080 in my sketch to solve same issue.
Give it a try. :wink:
But if you are trying to connect to web administrator, use 9443 as Peter said .