problem with sdl_net and udp packet sending
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?
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!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement