Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / how to sent network data?

Author
Message
Wanja
21
Years of Service
User Offline
Joined: 28th Aug 2002
Location:
Posted: 22nd Sep 2002 04:47
how do I sent the X Y Z (3 at all)values in ONE Interger net message?
Khumba
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location:
Posted: 22nd Sep 2002 18:57
That depends on the size of your XYZ values. If the XYZ values are integers or words, then you need to send them in 3 integer messages, because you can't get 3 integers or 3 words to fit into one integer. But if your values are bytes, then this code will compress them into one integer:

I = (X * 65536) + (Y * 256) + Z

Then to decode I, use this:

Z = (I && 0xFF)
Y = (I && 0xFF00) / 256
X = (I && 0xFF0000) / 65536
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 22nd Sep 2002 19:38
Use memblocks, they're ideal when sending stuff with the network commands.
Super Teo
21
Years of Service
User Offline
Joined: 18th Sep 2002
Location: Sweden
Posted: 22nd Sep 2002 21:37
Yeah I use Memblocks aswell. The best way to do it in my knowledge

Login to post a reply

Server time is: 2024-04-18 02:44:41
Your offset time is: 2024-04-18 02:44:41