Hello wayne,

Code is ok. And for the network byte order, it is in big endian format.
here a function to convert the endianess of an integer:

function Swap4(n: integer): integer;
asm
   bswap eax
end;

So you do something like this:

var
   len, size: Integer;
begin
   len := 4;
   size := Swap4(ImageStream.Size);
   aThread.Send(@size, len);

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Friday, February 1, 2008, 08:07, wayne forrest wrote:

> I have no joy yet, maybe you can assist a bit more,



> On the receiving side I have this in java:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> int ch1 = iStrm.read(); //read first byte
>                 int ch2 = iStrm.read(); //read second byte
>                 int ch3 = iStrm.read(); //read third byte
>                 int ch4 = iStrm.read(); //read fourth byte
>                 len = ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4));
> //convert bytes to integer
>                 System.out.println("LENGHT="+len);

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> on the Sending Side I have this ( ICS)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> var
>      len,size : Integer;

> begin
>      len := 4;
>      size := ImageStream.Size;
>      aThread.Send(@size,len);

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> My old code with Indy was :
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> aThread.Connection.WriteInteger(ImageStream.Size, true); // network byte
> Order




> On Jan 31, 2008 6:58 PM, Wilfried Mestdagh <[EMAIL PROTECTED]> wrote:

>> Hello wayne,
>>
>> Send(TheNumber, 4);
>> It will send in little endian format (as Intel CPU store it).
>>
>> ---
>> Rgds, Wilfried [TeamICS]
>> http://www.overbyte.be/eng/overbyte/teamics.html
>> http://www.mestdagh.biz
>>
>> Thursday, January 31, 2008, 15:24, wayne forrest wrote:
>>
>> > I am busy converting an Indy Application to ICS,
>>
>> > I have a Fucntion in Indy that is : WriteInteger(anInt, true); // where
>> true
>> > = network byte Order
>>
>> > How can I achieve this in ICS ?
>>
>> --
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
>>



> -- 
> C: 076 337 4368
> T: 021 880 2037
> F: 021 880 2530

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

Reply via email to