>In your server1 example, I modified the ReceiveBinComplete method of
>TClient as follows:
>
>procedure TClient.ReceiveBinComplete;
>var
>    data : TData;
>begin
>     Log(ltSystem, IntToStr(RcvdCount) + ' bytes received');
>     WritePtr := 0;                   // get ready for next receive
>     IsRcvBin := False;               // receiving of data is done
>     LineMode := True;                // we are going back to command mode
>     SendStr('+OK DATA'#13#10);       // tell the transmitter we have all data
>     Move(Rcvd^, Data, SizeOf(Data)); // Rcvd is the pointer to the buffer
>     Log(ltRx, 'data.name = ' + data.Name);
>     Log(ltRx, 'data.ID = ' + IntToStr(data.ID));
>end;
>
>but it returns an empty record.
>I don't understand why I get the exact length of received data (RcvdCount
>is 15, which is SizeOf(Data)) but Rcvd seems to point to an empty buffer.
>Maybe my pointer dereferencing code is wrong?
>Or should I need to use another function instead of Move()?

Finally I solved my problem and the solution was obviously the simplest ;)

There was this line in Wilfried's client code I didn't notice:

FillChar(Data, SizeOf(TData), 0);

I was filling my record before executing this line...
That's why I received an empty one.

Thank you guys for your help :)
--
Geppy Piloni

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to