getnamo / NodeJs-Unreal

Embed node.js as an Unreal Engine plugin.
MIT License
242 stars 36 forks source link

packaged exe main script crashing without internet access #27

Open JackGit3 opened 3 years ago

JackGit3 commented 3 years ago

If I run it in the editor with or without internet everything still works just fine. However in the packaged version if I turn off my internet connection then the mainscript crashes every time. Where would be a good starting point for me to dig into this issue or would anyone perhaps know why this might be happening?

getnamo commented 3 years ago

What does the log say? this is where the wrapper script starts, you may want to trace it from there to see where it could be crashing: https://github.com/getnamo/nodejs-ue4/blob/master/Content/Scripts/nodeWrapper.js#L101

xiaodoudou commented 3 years ago

I have exactly the same issue. If I shut down my network card the node process doesn't start.

[2021.05.12-15.41.30:574][  0]LogWorld: Bringing up level for play took: 0.001941
[2021.05.12-15.41.30:577][  0]LogTemp: RunScriptStart
[2021.05.12-15.41.30:579][  0]LogTemp: node thread start
[2021.05.12-15.41.30:579][  0]LogTemp: Starting node.exe at C:/Users/{OBFUSCATED}/Plugins/nodejs-ue4/Source/ThirdParty/node with ../../../Content/Scripts/nodeWrapper.js
[2021.05.12-15.41.30:579][  0]LogUMG: Display: Widget Class LiveTime_W_C - Loaded Fast Template.
[2021.05.12-15.41.30:579][  0]LogUMG: Display: Widget Class LiveScore_W_C - Loaded Fast Template.
[2021.05.12-15.41.30:580][  0]LogUMG: Display: Widget Class MainScreen_W_C - Loaded Fast Template.
[2021.05.12-15.41.30:582][  0]SocketIOLog: SocketIO Invalid appears to have lost connection, reconnecting attempt 0 with delay 5000
xiaodoudou commented 3 years ago

I need a bit of a test and end up binding HTTP to 127.0.0.1 instead. of localhost.

Inside: Plugins/nodejs-ue4/Source/CommandLine/Private/NodeCmd.cpp

-   Socket->Connect(FString::Printf(TEXT("http://localhost:%d"), Port));
+   Socket->Connect(FString::Printf(TEXT("http://127.0.0.1:%d"), Port));

Inside: Plugins/nodejs-ue4/Content/Scripts/nodeWrapper.js


-http.listen(k.port, ()=>{
+http.listen({
+   host: '127.0.0.1',
+   port: k.port,
+   exclusive: false,
+   readableAll: true,
+   writableAll: true
+}, ()=>{

Exclusive is default to false, so should be useless, and believe the readable/writable should be too, but we launch our game as admin (Kiosked PC)