Advertisement

Sending ints?

Started by February 24, 2005 07:55 PM
7 comments, last by krez 19 years, 11 months ago
Can anyone tell me how to send integers across the net? The send function doesn't support them unless I do (char*)&myInt, and converting them back is a mess that I'd like to get away from. Aren't there any other function I can use? I've tried to look, but send seems to be the only one there is:(
_______________________Afr0Games
Bump:P
_______________________Afr0Games
Advertisement
That's how you do it.

If you think reading and writing raw data is hard, you might want to look into a wrapper such as OpenTNL or RakNet which have classes that can marshal for you.
enum Bool { True, False, FileNotFound };
But hold on... does that mean that I simply cannot send numbers across the net? That's... horrible! I mean... strings are much less fast than ints and floats, right?
_______________________Afr0Games
Quote:
Original post by Afr0m@n
But hold on... does that mean that I simply cannot send numbers across the net? That's... horrible! I mean... strings are much less fast than ints and floats, right?


its just a bit man, a bit that represents a char is == to a bit that represents and int. :)
"Let Us Now Try Liberty"-- Frederick Bastiat
(char*)&theInt,sizeof(theInt) is how you do it. That doesn't mean you're sending it as text. There are links, and even a description of this thing, in the Forum FAQ.
enum Bool { True, False, FileNotFound };
Advertisement
Ok thanks:)

I managed to develop a solution in Blitz Basic that enabled me to pivk up the data:)

I can't believe that I'm actually building my own MMORPG lol! :D
_______________________Afr0Games
Read item #15 in the FAQ
-Mike
Quote:
Original post by Anon Mike
Read item #15 in the FAQ

item #0 might be a good idea too.
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])

This topic is closed to new replies.

Advertisement