Advertisement Jump to content
Sign in to follow this  
rogerdv

problem with sdl_net and udp packet sending

This topic is 4910 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

After digging in the net2 code i managed to write my own UDP based server, it is listening ok. But I cant write the client side, the UDP packet it is never sent. This is what I do: SDLNet_ResolveHost(&serverIP,"192.168.1.1", 1515); servsocket = SDLNet_UDP_Open(0); //Works fine, socket is opened chan = SDLNet_UDP_Bind(servsocket, -1, &serverIP); //Channel always returns 0, no error packet=SDLNet_AllocPacket(128); //I got a non-null value packet->data[0]=1; SDLNet_UDP_Send(servsocket,chan,packet); //and this always return !=1 But no data is received. Can somebody tell what is wrong here?

Share this post


Link to post
Share on other sites
Advertisement
Citing the SDL_net manual:
Quote:
Don't forget to set the length of the packet in the len element of the packet you are sending!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!