Closed cshenton closed 8 months ago
When running the server and client with the modified inet_ntop
prototype, the server gets to here:
[server]
server listening on 127.0.0.1:40000
server started with 256 client slots
Then, launching the client:
[client]
client started on port 51166
client id is fd67ff24bbdb0d0d
client connecting to server 127.0.0.1:40000 [1/1]
The server crashes. Then on the client:
client connect failed. connection request timed out
client disconnected
This seems to be an issue with the libsodium build. Linking against an official libsodium release works fine.
I'm going to close this since I think I'd prefer to use an up to date libsodium build alongside netcode anyway. Hopefully this is useful for anyone targeting this ABI who just wants to get the examples running in future.
Yes, I think you have made the right choice. In effect, the modified lib sodium build is really only supplied for convenience.
Sounds good. Do you think that if ( s->handle == INVALID_SOCKET )
is something to be concerned about / worth opening a separate issue for? The handle is 32 bit on windows and is being compared against a ~u64(0)
.
Let me look at the code and think about it
OK I think it's' fine. if you truncate ~0 64bit to 32bit, which will be what happens, it is still 0xFFFFFFFF which is correct.
I believe the behaviour goes the other way. The uint32_t
is promoted to a uint64_t
and the compiler will optimize the comparison away.
An explicit cast to uint32_t
might be necessary: https://godbolt.org/z/Md96Yr6Y4
Ah, in that case could you create a PR?
Will do.
I'm evaluating
netcode
for integration with my C VR engine, and am running into issues buildingclient.c
andserver.c
for windows using the mingw ABI.Using the zig compiler toolchain, I am compiling with:
(in a shell that supports * wildcards, such as Git Bash)
This gives me the following error:
If I correct
socklen_t
tosize_t
the error disappears, and I can build both client and server. However the server crashes upon attempted client connection.Changes are I've made an error in my compiler config, but since I will plan to integrate this into my own build system, it would be great to understand how to build netcode without the premake build script.