-
Notifications
You must be signed in to change notification settings - Fork 66
Description
SDL3_net is used.
The SDL3 socket is created correctly.
On send SDLNet_SendDatagram returns false.
With SDL_GetError it returns this:
Failed to send from socket: Invalid argument.
Example output from OpenTyrian 2000 (adapted for SDL3):
SDLNet_SendDatagram: Failed to send from socket: Invalid argument, host: 172.16.197.130, port: 1333, length: 20 (3)
C send datagram code:
if (SDLNet_SendDatagram(socket, packet_out_temp->addr, packet_out_temp->port, packet_out_temp->buf, packet_out_temp->buflen) == false) { fprintf(stderr, "SDLNet_SendDatagram: %s, host: %s, port: %d, length: %d (3)\n", SDL_GetError(), SDLNet_GetAddressString(ip), network_opponent_port, packet_out_temp->buflen); return false; }
Code of the app:
https://github.com/andyvand/opentyrian2000/blob/master/src/network.c
I have also adapted voipchat.c for checking SDLNet_SendDatagram, result is the same:
if (SDLNet_SendDatagram(sock, server_addr, server_port, scratch_area, br + extra) == false) { SDL_Log("ERROR: Send %d datagram bytes to server %s:%d - %s", br + extra, SDLNet_GetAddressString(server_addr), (int) server_port, SDL_GetError()); }
Output under macOS:
2025-02-01 10:31:33.603 voipchat[8376:555267] CLIENT: Sending 1200 new bytes to server at 127.0.0.1:3025... 2025-02-01 10:31:33.603 voipchat[8376:555267] ERROR: Send 1200 datagram bytes to server 127.0.0.1:3025 - Failed to send from socket: Invalid argument
Output under Windows:
ERROR: Send 598 datagram bytes to server 127.0.0.1:3025 - Failed to send from socket: Het systeem heeft een ongeldig pointeradres gevonden tijdens de poging om een pointerargument te gebruiken in een aanroep.
So the problem must be in the library but I haven't found the solution yet...
It has something to do with invalid pointers.