[gameprogrammer] Re: udp ping with sdl_net

On 8/18/05, Roger D Vargas <luo_hei@xxxxxxxx> wrote:
> Im trying to implement a simple udp ping to my server. The client sends
> a packet and server must reply with info about current load and version.
>   I would like to avoid binding a new channel to send the packet back,
> is that possible?

Yes. Sockets are bi-directional.

> What member in the UDP_Packet tells me the origin IP?

In regular socket programming, for UDP,  the address is collected into
the sockaddr_in data structure the first time you call recvfrom() on
the server, which is why you have to use recvfrom() for the first
read, instead of normal read() and write(), unlike TCP programming.
After the first read you can use read() and write() because the return
address is available.

I am not sure how SDL_Net does it, but the above may be a clue.

Chris

-- 
E-Mail: Chris Nystrom <cnystrom@xxxxxxxxx>
Business: http://www.shaklee.net/austin
Blog: http://conversazione.blogspot.com/
AIM: nystromchris


---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: