indy udp client

2005-02-19 07:42:21 AM
I'm still learning how to use Indy. I've been very happy with them so far.
Anyway, I am sending data over a udp connection from a client to server and
vice versa. This data is arranged so that the first 4 bytes are the size of
the data and the rest is the actual size of the data.
Now, if I read the data like this :
int DataSize;
if(UdpClient1->ReadBuffer(&DataSize, sizeof(int)) == sizeof(int)){
char* Buffer = new char[DataSize];
if(UdpClient1->ReadBuffer(Buffer, DataSize) == DataSize){
// process data here.
delete[] Buffer;
Will it work successfully ?