76
Network / TCP Server, Wait() + Send
« on: January 23, 2011, 07:53:12 am »
Have your two Classes under a namespace, and use a variable in the scope of the namespace (not in any class).
It it really that bad passing around a pointer or two?
Also, the passing a pointer stuff:
You're initialisation stuff is okay:
For taking in a pointer:
And when you call the method (initialize will be a constructor?):
I could be wrong here, but I'm pretty sure it's right. Any doubts, see http://www.cplusplus.com/doc/tutorial/pointers/
It it really that bad passing around a pointer or two?
Also, the passing a pointer stuff:
You're initialisation stuff is okay:
Code: [Select]
vector<SocketTCP > *clist;
For taking in a pointer:
Code: [Select]
func initialize(SocketTCP s, *vector c ){ // notice the "*"
scoketFromServer = s;
clist=c;
}
And when you call the method (initialize will be a constructor?):
Code: [Select]
ServerReceiver a(some_socket, &some_vector); // the & means address of
I could be wrong here, but I'm pretty sure it's right. Any doubts, see http://www.cplusplus.com/doc/tutorial/pointers/