[SDL] SDL_net and broadcasting

Alan Wolfe atrix2 at cox.net
Sun Sep 29 23:09:01 PDT 2002


1)Change the
UDPsocket SDLNet_UDP_Open(Uint16 port)
to
UDPsocket SDLNet_UDP_Open(Uint16 port, int broadcast)
This is cleaner toward UNIX way to see broadcast, but we loose backward
compatiblity.


in response to that you could do this to maintain backwards compatibility
couldnt you?

UDPsocket SDLNet_UDP_Open(Uint16 port, int broadcast=0)


----- Original Message -----
From: "nuage" <nuage at ysagoon.com>
To: <sdl at libsdl.org>
Sent: Sunday, September 29, 2002 4:47 PM
Subject: [SDL] SDL_net and broadcasting


> Hello.
>
> **My motivations
> I'm currently working on a great GPL game, "globulation2", aviable on
> savanah.
> Thatfor, I need broadcasting ability in the LAN or subnet. (sening to ip
> 255.255.255.255)
> But SDL_net does not provide the abitity to send packet to ip
> 255.255.255.255.
> Therefore, I programmed a UNIX C++ object to allow easy broadcasing, and
> it's working fine on GNU/Linux.
> (But I have some header/#define trouble on macosX and Solaris, fixed by
> changing the makefile.)
> Therefor it would be nicer to implements broadcasting info SDL, and
> everyone could use it !
>
> **My questions
> Is anyone else interested in the broadcasting ability ?
> How would you like broadcasting ability to be implemented in SDL_Net ?
> Who know about OpenTransport and broadcasting ?
> Who is the SDL_net responsible ?
>
> **Technical considerations
> I know about UNIX over IP programming, but not OpenTransport at all.
> The problem is that you have to change the "socketDefinition" to allow
> broadcasting.
> This corresponds to "UDPsocket" in SDL_net.
> Then I see two possiblilities:
>
> 1)Change the
> UDPsocket SDLNet_UDP_Open(Uint16 port)
> to
> UDPsocket SDLNet_UDP_Open(Uint16 port, int broadcast)
> This is cleaner toward UNIX way to see broadcast, but we loose backward
> compatiblity.
>
> 2)We dynamicaly changes the SocketDefinition's flags before and after
> sending the UDP packet.
> This would looks like:  this is only the idea)
>
> #define INADDR_BROADCASTING    0xFFFFFFFF
> if (packets[i]->address.host=INADDR_BROADCASTING)
> {
>    int socketDefinition=sock->channel;
>    char ttl=1;
>    setsockopt(socketDefinition, IPPROTO_IP, IP_MULTICAST_TTL, &ttl,
> sizeof(ttl));
>    int hold=1;
>    setsockopt(socketDefinition, SOL_SOCKET, SO_BROADCAST, &hold,
> sizeof(hold));
> }
>
> // more the recovering part after sending
>
> **Who will do the work
> If any choice is made, can programm the UNIX part of it.
> But i'm looking for someone to do it for OpenTransport.
>
> Thanks!
>
> Luc-Olivier de Charrière
>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
>
>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl





More information about the SDL mailing list