Re: [Gambas-user] htonl equal

2010-04-12 Thread Les Hardy


I guess *gb.BigEndian* and *gb.LittleEndian* are what you are looking for.
*System.ByteOrder* will return the endianness of the operating system.


Regards
Les Hardy




Mohammad Razeghi wrote:
 Hi

 I am looking for c++ htonl function equal in gambas can any one help please
 ?

 Thanks ...
 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user

   


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] htonl equal

2010-04-12 Thread Les Hardy

You can use htonl/ntohl from external libs.
A very quick example below. Please correct me if I got it wrong.

' Gambas module file
PUBLIC EXTERN htonl(ln AS Long) AS Long IN libc:6
PUBLIC EXTERN ntohl(ln AS Long) AS Long IN libc:6

PUBLIC SUB Main()
DIM ln, lh AS Integer

ln = 1193046

PRINT Input:   ln
PRINT Input (hex):   Hex(ln, 8)

lh = htonl(ln) ' to BigEndian
PRINT BigEndian:   lh
PRINT BigEndian (hex):   Hex$(lh, 8)

ln = ntohl(lh) ' back to LittleEndian
PRINT LittleEndian:   ln
PRINT LittleEndian (hex):   Hex$(ln, 8)
END



Regards
Les Hardy





Mohammad Razeghi wrote:
 Hi

 I am looking for c++ htonl function equal in gambas can any one help please
 ?

 Thanks ...
   


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] htonl equal

2010-04-12 Thread Benoît Minisini
 You can use htonl/ntohl from external libs.
 A very quick example below. Please correct me if I got it wrong.
 
 ' Gambas module file
 PUBLIC EXTERN htonl(ln AS Long) AS Long IN libc:6
 PUBLIC EXTERN ntohl(ln AS Long) AS Long IN libc:6
 
 PUBLIC SUB Main()
 DIM ln, lh AS Integer
 
 ln = 1193046
 
 PRINT Input:   ln
 PRINT Input (hex):   Hex(ln, 8)
 
 lh = htonl(ln) ' to BigEndian
 PRINT BigEndian:   lh
 PRINT BigEndian (hex):   Hex$(lh, 8)
 
 ln = ntohl(lh) ' back to LittleEndian
 PRINT LittleEndian:   ln
 PRINT LittleEndian (hex):   Hex$(ln, 8)
 END
 
 
 
 Regards
 Les Hardy
 
 Mohammad Razeghi wrote:
  Hi
  
  I am looking for c++ htonl function equal in gambas can any one help
  please ?
  
  Thanks ...
 

As the network byte order seems to be Big Endian, you can set the ByteOrder 
property of your socket to gb.BigEndian.

Logically, you should not have to use htonl() or ntohl(), so I'm curious why 
you need these functions.

Regards,

-- 
Benoît Minisini

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] htonl equal

2010-04-11 Thread Mohammad Razeghi
Hi

I am looking for c++ htonl function equal in gambas can any one help please
?

Thanks ...
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user