Skip to main content
gamedev.net
🔒 Locked

Sending ints?

Started by Afr0m@n Feb 24, 2005 at 7:55 PM 7 replies 1.4k views
Original Post
Afr0m@n
Afr0m@n
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
Afr0m@n
Afr0m@n
Bump:P
_______________________Afr0Games
hplus0603
hplus0603
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 };
Afr0m@n
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?
_______________________Afr0Games
Dreddnafious Maelstrom
Dreddnafious Maelstrom
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
hplus0603
hplus0603
(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 };
Afr0m@n
Afr0m@n
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
Anon Mike
Anon Mike
Read item #15 in the FAQ
-Mike
krez
krez
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])

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.