Repository navigation
Update network functionality to use SDL_net instead of lowlevel sockets - #10
Merged
Merged
Conversation
Owner
|
@copilot retry |
- Replaced POSIX socket includes with SDL2/SDL_net.h - Implemented socket handle mapping for SDL_net TCPsocket management - Updated NET_Write to use SDLNet_TCP_Send - Updated NET_Read to use SDLNet_TCP_Recv - Updated NET_TCPListen to use SDLNet_ResolveHost and SDLNet_TCP_Open - Updated NET_TCPAccept to use SDLNet_TCP_Accept - Updated NET_TCPConnect to use SDLNet_ResolveHost and SDLNet_TCP_Open - Updated NET_CloseSocket to use SDLNet_TCP_Close - Updated NET_DiscoverGames to use SDL_net UDP functions - Removed NET_SetNonBlocking (SDL_net handles non-blocking internally) - Added SDLNet_Init/SDLNet_Quit calls in Com_Init/Com_Quit - Updated Makefile to link SDL2_net library - Build tested successfully on Linux Co-authored-by: corepunch <83646194+corepunch@users.noreply.github.com>
Contributor
Author
I've completed the migration from low-level POSIX sockets to SDL_net. The implementation includes: Changes made:
Build status: ✅ Successfully compiles on Linux with no errors Commit: 4ddee54 |
- Fixed NET_TCPConnect to properly handle socket replacement - Added buffer overflow protection in NET_DiscoverGames UDP packet handling - Improved error handling for invalid socket handles Co-authored-by: corepunch <83646194+corepunch@users.noreply.github.com>
- Use SDLNet_ResolveHost for broadcast address to ensure proper byte ordering - Add additional bounds checking for UDP packet buffer overflow protection - Document NET_TCPSocket deprecation with SDL_net implementation Co-authored-by: corepunch <83646194+corepunch@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update network functionality to use SDL instead of lowlevel
Update network functionality to use SDL_net instead of lowlevel sockets
Jan 14, 2026
corepunch
marked this pull request as ready for review
January 14, 2026 10:55
corepunch
approved these changes
Jan 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR migrates the network functionality from low-level POSIX sockets to SDL_net library, improving cross-platform compatibility and integrating better with the project's existing SDL2 architecture.
Changes Made
Network Implementation
NET_Write→ usesSDLNet_TCP_SendNET_Read→ usesSDLNet_TCP_RecvNET_TCPListen→ usesSDLNet_ResolveHost+SDLNet_TCP_OpenNET_TCPAccept→ usesSDLNet_TCP_AcceptNET_TCPConnect→ usesSDLNet_ResolveHost+SDLNet_TCP_OpenNET_CloseSocket→ usesSDLNet_TCP_CloseNET_DiscoverGames) to use SDL_net UDP functionsNET_SetNonBlocking(SDL_net handles non-blocking internally)SDLNet_Init/SDLNet_Quitcalls inCom_Init/Com_QuitBuild Configuration
src/common/net.h- API remains compatibleSecurity & Robustness
SDLNet_ResolveHostfor broadcast addressesTesting
USE_LOOPBACK) remains unchanged for local developmentBenefits
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.