problem with sdl_net and udp packet sending

Started by
2 comments, last by jkuhlmann 18 years, 8 months ago
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?
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!
Yes, that was the problem! I managed to miss that in the docs.
Yeah, I also made that mistake, when I tried to get it working [wink]

This topic is closed to new replies.

Advertisement