Allocate a new UDP packet with a data buffer
a pointer to a new empty UDPpacket. NULL is returned on errors, such as out-of-memory.
Binds to C-function call in SDL_net.h:
extern DECLSPEC UDPpacket * SDLCALL SDLNet_AllocPacket(int size)
// create a new UDPpacket to hold 1024 bytes of data
UDPpacket *packet;
packet=SDLNet_AllocPacket(1024);
if(!packet) {
printf("SDLNet_AllocPacket: %s\n", SDLNet_GetError());
// perhaps do something else since you can't make this packet
}
else {
// do stuff with this new packet
// SDLNet_FreePacket this packet when finished with it
}
SdlNet Class | Tao.Sdl Namespace | SdlNet.UDPpacket | SdlNet.IPaddress | SDLNet_AllocPacketV | SDLNet_ResizePacket | SDLNet_FreePacket | SDLNet_UDP_Send | SDLNet_UDP_SendV