SDL_net | A simple , cross-platform wrapper over TCP/IP sockets | TCP library

 by   libsdl-org C Version: release-2.2.0 License: Zlib

kandi X-RAY | SDL_net Summary

kandi X-RAY | SDL_net Summary

SDL_net is a C library typically used in Networking, TCP applications. SDL_net has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

The latest version of this library is available from: This is an example portable network library for use with SDL. It is available under the zlib license, found in the file COPYING.txt. The API can be found in the file SDL_net.h This library supports UNIX, Windows, MacOS Classic, MacOS X, BeOS and QNX. The demo program is a chat client and server. The chat client requires the sample GUI library available at: The chat client connects to the server via TCP, registering itself. The server sends back a list of connected clients, and keeps the client updated with the status of other clients. Every line of text from a client is sent via UDP to every other client. Note that this isn't necessarily how you would want to write a chat program, but it demonstrates how to use the basic features of the network library. Enjoy! -Sam Lantinga and Roy Wood.

            kandi-support Support

              SDL_net has a low active ecosystem.
              It has 112 star(s) with 37 fork(s). There are 16 watchers for this library.
              It had no major release in the last 12 months.
              There are 10 open issues and 39 have been closed. On average issues are closed in 34 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of SDL_net is release-2.2.0

            kandi-Quality Quality

              SDL_net has no bugs reported.

            kandi-Security Security

              SDL_net has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              SDL_net is licensed under the Zlib License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              SDL_net releases are available to install and integrate.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of SDL_net
            Get all kandi verified functions for this library.

            SDL_net Key Features

            No Key Features are available at this moment for SDL_net.

            SDL_net Examples and Code Snippets

            No Code Snippets are available at this moment for SDL_net.

            Community Discussions


            Link SDL2_net with CMake
            Asked 2019-Mar-09 at 09:01

            I'm trying to link SDL2_net (SDL_net 2.0) to my project via CMake, but after searching around I've yet to find a solution. My CMakeLists.txt currently looks like this:



            Answered 2019-Mar-02 at 07:49

            Since the person who provided an answer only posted a comment about it, I'll put it down here myself.

            The solution was seemingly very simple: I had written pkg_search_module (SDL_NET REQUIRED sdl2_net), while it was supposed to be pkg_search_module (SDL_NET REQUIRED SDL2_net).



            sdl_net The application was unable to start correctly (0xc000007b)
            Asked 2018-Aug-17 at 18:37

            I'm trying to compile and run the following code:



            Answered 2018-May-18 at 22:47

            I solved the issue by the following:

            1. Installed mingw-w64 instead of mingw32 and set that as my compiler. I had to change most of the toolchain executables so that they pointed to files with "x86_64-w64-mingw32-" in the name (for example, "gcc.exe" was changed to "x86_64-w64-mingw32-gcc.exe"). the Resource Compiler and Make program names were unchanged.

            2. Using the binaries in the x86_x64-mingw32 folder of the SDL_Net development library did not work. I had to replace them with the SDL2_net-2.0.1-win32-x64 runtime binaries that you can download directly on the SDL_Net homepage.

            //Note: Maybe the "i686-w64-mingw32" development library binaries would have worked... I didn't test it. I always get confused when "64" is prefaced by "86" and "686", and in the case of these dev libraries, the other option is "x86_64-w64-mingw32".... so which one is really x64, and which one is x32? Not sure.

            1. After I made that change, I stopped getting the titular error in my original post. Instead, now when I try to run the compiled program, I would get errors about missing DLLs. Further, these errors only happened when I ran the program via the executable in "debug"; the errors didn't happen when I ran the program by pressing the "play" button in Code::Blocks. After some hunting, I solved this problem by changing my linker options to the following:

            -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_net -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic

            //Note: I don't actually fully understand what "-Wl,-Bstatic" and "-Wl,-Bdynamic" do. I wish someone would explain that to me.

            I hope this helps somebody!



            FFmpeg: Decoding AVPackets received from UDP socket
            Asked 2018-Jun-19 at 10:25

            I am trying to stream video frames encoded with FFmpeg from an Unity game to a client UI via UDP. To be specific, I am sending AVPackets (which contain the compressed frames, as far as I understand) from the server, which are then, on the client side, extracted as follows:



            Answered 2018-Jun-19 at 10:25

            -22 means -EINVAL, Invalid argument. You can normally check the ffmpeg error log messages for more details.

            My guess is that your packets are still fragmented, but avcodec_send_packet() expects AVPacket to always contain a full frame. Depending on the codec involved you should consider using an AVParser to recover the framing or frame the packets before UDP fragmentation, so you can recover the framing by yourself.



            C++ SDL2 Net: Integer Array over TCP
            Asked 2018-May-03 at 05:55

            I'm trying to add networking to my project; more specifically, sending grid information, in the form of an integer array ([x, y, ...]), to the server for processing. The only comprehensive guide I found to SDL2 Net using TCP sends strings, and uses this code to convert a string to a void *:



            Answered 2018-Mar-15 at 15:17

            You can just use an integer array name as void pointer via 'array decay' to a pointer



            sdl_net udp server setup
            Asked 2017-Mar-25 at 10:02

            I've looked at tutorials and many other places on how to do this however I'm still having trouble getting this to work. Interestingly enough I did find a tutorial (which is where I derived this code from) on how to setup a UDP chat program which was wonderful for a basic example.

            However just as soon as I do non local testing (I switch the IP for the server the client is supposed to connect to from localhost to my real IP), the packet ends up not being received. I can't help but feel that I've setup the server portion of this code wrong.

            So here's what I have so far.

            Network.h //the UDP networking code.



            Answered 2017-Mar-25 at 10:00

            (Posted on behalf of the OP)

            This is pretty much resolved. the problem wasn't the code it was the modem my isp gave me. Turns it's possible and recommended to buy your own modem (facepalm).


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install SDL_net

            You can download it from GitHub.


            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone libsdl-org/SDL_net

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular TCP Libraries


            by robertdavidgraham


            by vishnubob


            by panjf2000


            by quasar


            by mumble-voip

            Try Top Libraries by libsdl-org


            by libsdl-orgC


            by libsdl-orgC


            by libsdl-orgC


            by libsdl-orgC


            by libsdl-orgC