Radioactive-Software Radioactive-Software
Forum to discuss Radioactive-Software Products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

winsock netcode

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Radioactive-Software Forum Index -> Programming
View previous topic :: View next topic  
Author Message
Anddos
Jehovah's Witness


Joined: 24 May 2009
Posts: 29

PostPosted: Wed Jun 24, 2009 6:35 pm    Post subject: winsock netcode Reply with quote

i am learning to use winsock for windows and was wondering in order to send multiple data at once you can send a struct or class object over the socket?

like Data data;
data.valueA = 100;
data.valueB = 150;
data.valueC = 200;

then do send(sock,data,sizeof(data),0);
but its asking for char* as parameter 2?
Back to top
View user's profile Send private message
dgreen
The One


Joined: 24 Sep 2005
Posts: 6811
Location: Raleigh, NC

PostPosted: Wed Jun 24, 2009 6:41 pm    Post subject: Re: winsock netcode Reply with quote

Anddos wrote:
i am learning to use winsock for windows and was wondering in order to send multiple data at once you can send a struct or class object over the socket?

like Data data;
data.valueA = 100;
data.valueB = 150;
data.valueC = 200;

then do send(sock,data,sizeof(data),0);
but its asking for char* as parameter 2?


&data ?
_________________
I run this place.
"Some muckety-muck architecture magazine was interviewing Will Wright about SimCity, and they asked
him a question something like "which ontological urban paridigm most influenced your design of the simulator,
the Exo-Hamiltonian Pattern Language Movement, or the Intra-Urban Deconstructionist Sub-Culture Hypothesis?"
He replied, "I just kind of optimized for game play."

Back to top
View user's profile Send private message Visit poster's website AIM Address
Anddos
Jehovah's Witness


Joined: 24 May 2009
Posts: 29

PostPosted: Thu Jul 30, 2009 8:18 pm    Post subject: Reply with quote

people are saying its bad to send structs over a socket and should serialize each data instead like
send(sock,(char*)&TheFloat,sizeof(TheFloat),0);
recv(sock,(char*)&TheFloat,sizeof(TheFloat),0);

but does'nt this mean using send alot instead of using 1 send to send a struct of member values?
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Radioactive-Software Forum Index -> Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group