UDP send of 1237 bytes failed with error 35 - node.js

I have an Electron and PeerJS built app. It uses PeerJS to make file transfer between 2 WebRTC data channel connected clients. File transfer works perfectly, but sender side main process (not browser renderer process) gets following random console.log errors observed in VS code Terminal console:
[29071:0703/195348.080594:ERROR:stun_port.cc(308)] Port[dc1b4600:0:1:0:local:Net[en0:192.168.8.x/24:Wifi:id=1]]: UDP send of 1237 bytes failed with error 35
[29071:0703/195348.081743:ERROR:stun_port.cc(308)] Port[dc1b4600:0:1:0:local:Net[en0:192.168.8.x/24:Wifi:id=1]]: UDP send of 1237 bytes failed with error 35
The data channel packet size is 512KB (file is sliced into chunks). Above error shows for every few chunks.
Main process uses followings to slice file into chunks:
const chunkSize = 512 * 1024;
fs.createReadStream(fullFileName, {highWaterMark: chunkSize});
It's originated from NodeJS file read or PeerJS? Since it's from VS code, it should not be from WebRTC. But it shows "stun_port.cc" which should be WebRTC related issue.
What's the reason of the error? How to fix it?

Related

NodeJS socket hang up while using Raspberry Pi with SIM and cellular internet

Im reading a CSV File to a string. After this i upload the data to the server with a post request. If the content is getting larger i get the following error:
Error: socket hang up
at connResetException (internal/errors.js:628:14)
at TLSSocket.socketOnEnd (_http_client.js:499:23)
at TLSSocket.emit (events.js:387:35)
at endReadableNT (internal/streams/readable.js:1317:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
code: 'ECONNRESET'
}
However this error only occurs if i'm using the celluar internet. If i'm using a network cable everything works fine. I tested with a CSV file with 1000 rows and had no problems.
The hang up will come if i get something like 20 rows.
I looked up the error and tried a bunch of different things. For example i installed the agentkeepalive npm package and set the timeouts and sockets up, but it doesn't help.
The backend is a PHP script, where i write data to a database. If i don't send data and set a sleep in the php Script for 20 seconds everything works fine.
But if i do send data, i get the socket hang up after exactly 10 seconds.
Note: This is running on a raspberry pi 4.
Does anyone have any ideas?

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb3 in position 4: invalid start byte

I'm a CS student learning network programming. I'm using python to develop a chat application using the server-client network functions like socket function, bind function, receive function and etc. But I encounter this problem in the server code which I don't understand since I have never learnt python programming language before. Could you help me?
The error occurs at
print(f'Received encrypted message from {user["data"].decode("utf-8")}: {encMsg["data"].decode("utf-8")}')
# Get user by notified socket, so we will know who sent the message
user = clients[notified_socket]
print(f'Received encrypted message from {user["data"].decode("utf-8")}: {encMsg["data"].decode("utf-8")}')
# Iterate over connected clients and broadcast message
for client_socket in clients:
# But don't sent it to sender
if client_socket != notified_socket:

Exposing setSocketOptions for node.js datagram

I'm trying to increase the SO_RCVBUF of a datagram socket in order to run a high-bandwidth UDP stream. With the default settings I am dropping packets even when doing no processing. Looking around this seems to be an issue related to the default buffer sizes when creating sockets in windows. I don't seem to have an issue with packets dropping in Linux so I am fairly certain it is the buffer size problem.
The issue is that the native node.js dgram class does not expose setsockopt for the socket so I can't change SO_RCVBUF.
I have found a potential solution through node-ffi, as outlined in this response, however when I try to load the FFI library I get a win32 error regarding the dll. From my understanding, entering null as the library name should just load the current process, where node.js is residing. Is this correct? The default example from ffi is below but gives the same win32 error 127 result. Should I be pointing it at a different dll, perhaps libuv?
const ffi = require('ffi');
var current = ffi.Library(null, {
'atoi': ['int', ['string']]
});
If it helps I am running Windows 10, and the code is running on a node child process forked from the electron main process.
Node: 7.9.0
Electron 1.7.4

Screen Sharing using OPensips ,Blink and Sylk server

I want to implement screen sharing using opensips , Blink and Sylk server utilities.
When I use msrp relay and opensips setup i get following errors:
debug: session
y2tmlOfHnQHa3mBUxG50IzE0NTMyODY3OTcuNTQzOjE5Mi4xNjguNy4xNzU= for
1009#192.168.5.178 (UNBOUND): AUTH succeeded, creating new session
debug: session
y2tmlOfHnQHa3mBUxG50IzE0NTMyODY3OTcuNTQzOjE5Mi4xNjguNy4xNzU= for
1009#192.168.5.178 (UNBOUND): Connection lost: Connection was closed
cleanly.
debug: session
y2tmlOfHnQHa3mBUxG50IzE0NTMyODY3OTcuNTQzOjE5Mi4xNjguNy4xNzU= for
1009#192.168.5.178 (DISCONNECTED): bytes sent: 408, bytes received: 0
I suspect if we can use msrp relay for screen sharing as i just found IM and File share as the features in its documentation.
Can somebody help me with this implementation?
Can we use sylk server in the server setting option of blink client instead of msrprelay with 5061 port?

Read multiple responses from TCP Socket

I am trying to query an INSTEON home automation server using a js net socket.
When I connect interactively and send a status query via the console I get two packets back:
Connected to: xxx.xxx.xxx.xxx:9761
02621FE3E80f1900 <-- typed into console
Send: 02621FE3E80f1900
Rsvd: 02621fe3e80f190006
Rsvd: 02501fe3e81ec00a2f0000
quit <-- typed into console
Connection closed
The second one arrives about half a second after the first.
However, when I try to send the message inside the js script, using: client.write('02621FE3E80f1900','hex'); I only get the first message back:
Connected to: xxx.xxx.xxx.xxx:9761
Rsvd: 02621fe3e80f190006
Connection closed
How can I get access to both messages?
I need the first message to confirm my query was received successfully,
and the second message in a string so I can interrogate it...
John

Resources