Good morning,
Say I have various types of messages to send across the network, but obviously I can only send them as an object. How do I split where the various messages are sent when they get to the server?
I've been going around in circles, and the obvious way (in my head) to handle this is to have some sort of header (using an interface), and then do a switch depending on what's in the header, and cast the object to the specific type.
But something's telling me this is a bad way of doing it, it doesn't feel very OO. any suggestions?
Alex
Sending (and then handling messages) to a server
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Matthew Cox17 pointsPosted Jan 15, 2008, 1:05 PM EST
A google search on chat programs using sockets will yield you many results. But, instead of sending byte[] of strings, you are sending you own objects.
Hope that helps.
Alex3 pointsPosted Jan 15, 2008, 1:07 PM EST