[Lazarus] lNet UDP and the send-function
John vd Waeter
john at jvdw.nl
Thu Dec 24 13:35:42 CET 2009
Hi Joel,
No, that was not the problem.
The buffer I talked about is actually a record.
First I filled record.Buffer and record.sizeofbuffer
Then I pass this record to a routine that calculates and adds a checksum
to the buffer, hereby adding 2 bytes to the buffer and thus adding 2 to
the size.
Only now the record is ready to be sent by the UDP
But the thread that does the sending just captured the buffer while it
was filled with the contents, but no crc added yet, so just inbetween
the steps mentioned above. Hence the size was 2 bytes smaller then expected.
Just developing on x86.
John
IntelliAdmin Support wrote:
> John,
>
> I have a question about that. Normally access to integer values is
> atomic, and you do not need to thread protect them when accessing. Was
> this size value a 32 bit integer value?
>
> Or are you compiling on a different hardware platform than x86?
>
> Thanks,
>
> Joel
>
> On Thu, Dec 24, 2009 at 6:49 AM, John vd Waeter <john at jvdw.nl> wrote:
>> Ok, solved.
>> Did not realize in multithread environment one thread could read a variabele
>> when other thread was just not finished filling this variabele....
>>
>> --
>> _______________________________________________
>> Lazarus mailing list
>> Lazarus at lists.lazarus.freepascal.org
>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
--
John vd Waeter
www.jvdw.nl
www.gps-carpool.net
www.shotinthedark.nl
www.pdaforms.nl
www.dbapocket.nl
john at jvdw.nl
More information about the Lazarus
mailing list