PDA

View Full Version : SDL_net Questions



Cpt_USMC
July 2nd, 2011, 10:48 PM
I think you guys may have missed my post...:sad:...well basically I was wondering if you guys knew what these functions were, what they did, & when is it applicable for them to be used? I'm using a UDP approach working from SDL_net. Also, how does the server know where packets come from so it can send something back?

SDLNet_ResolveHost( IPaddress * address, char * host, Uint16 port )

What does it mean when "host" is NULL?


SDLNet_UDP_Bind( UDPsocket sock, int channel, IPaddress * address )

What are you binding and What is the purpose to binding?


SDLNet_UDP_GetPeerAddress( UDPsocket sock, int channel )

When would you use this?



:KS PS: For a more detailed list of questions please visit my prior post.
http://ubuntuforums.org/showthread.php?t=1795073

Thanks,
~Cpt_USMC

bbqroast
November 26th, 2011, 04:16 AM
SDLNet_ResolveHost( IPaddress * address, char * host, Uint16 port )
[LIST]
What does it mean when "host" is NULL?


You use NULL to tell it you are listening (a server listens).


SDLNet_UDP_Bind( UDPsocket sock, int channel, IPaddress * address )

What are you binding and What is the purpose to binding?


Binding is for sockets, it asks the OS "Oh, can I reserve port x?". In order to listen to a port you must bind it to your program.


SDLNet_UDP_GetPeerAddress( UDPsocket sock, int channel )

When would you use this?


To get the IP of the computer who sent you the packet.