Hi Nick,
I just found your post, as I'm experiencing the same problem. Client works
as expected in NodeJS but in Electron it will not reconnect.
Do you have any new information?
best regards
Anders Thorsby
On Wednesday, 1 November 2017 20:11:50 UTC+1, Nick Tsutsunava wrote:
>
> I'm experiencing bizarre behaviour which I can't seem to debug. I have a
> Electron (NodeJS) application which connects to a remote TCP socket server
> (also written in NodeJS) on startup. This works fine.
>
> However, once I disconnect and try to reconnect it hangs on the connect
> method.
>
> this.socket = net.connect(this.port, this.host, () => {
> this.connected = true
> console.log('Connected!')})
>
> The strange thing is, that I do not get this behaviour when the server
> runs on 'localhost', this only happens when I run it on a computer on the
> local network. The remote server doesn't have a firewall (Ubuntu 16.04).
>
> Now, when I restart the Electron application it connects fine again.
>
> Is there some sort of protocol I am missing when destroying a connection
> which is different for localhost as opposed to local networks?
>
> I close the connection from the client like so
>
> close() {
> this.connected = false
> try {
> this.socket.end()
> this.socket.destroy()
> console.log('Destroying socket connection')
> } catch (e) {
> console.log(e.message)
> }}
>
> Another test that I did was running ncat -l 30000 instead of my NodeJS
> server to find out if it was the client or the server causing the trouble.
>
> Turns out it's the client. I can connect to ncat. I can then close the
> connection causing ncat to exit. If I restart ncat -l 30000 and try to
> connect to it from the client, it doesn't connect.
>
> Repeating this experiment on the same computer as the client (localhost)
> I do not experience this behaviour.
>
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/e3fde13b-172b-4cb7-af7d-647edb441484%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.