Reputation: 9001
My current class is planning on creating a basic networked game, but we have decided to take on the task of making a C++ server with a C# client. I understand this is probably a difficult task, but I was wondering if there is any advice on making this happen.
I am sorry I do not have any more information than this. We are just getting started and just want to make sure this is possible within the time span we have.
Upvotes: 1
Views: 602
Reputation: 54353
For a chat program, try using a chat protocol.
Examine XMPP and see if you can use it, or a cut down version. Starting from what others have figured out is never a bad idea. At the very least you can see what you don't like about it. :)
Upvotes: 0
Reputation: 285007
As everyone's said, this isn't an issue at all if your chat protocol is well-designed. Only if you were using hacks like using BinaryFormatter to directly serialize CLR objects onto the wire would you have a problem...
I would recommend you use existing protocols (e.g. IRC) and/or libraries to the extent you're allowed.
Upvotes: 2
Reputation: 89113
It's really not a big issue - as long as you come up with a good protocol. The bits on the wire don't care what language was used to write the program that interprets them.
By protocol I mean you need a clear understanding of who should do what when, what to say, and what to expect back.
For example, an echo server and its client might expect that
And so on. A different client that sent the message length before the message instead of using a end of input identifier wouldn't work with the original server, because of protocol incompatibilities.
Protocols can be flexible, but you have to account for that flexibility in the protocol itself.
Upvotes: 3
Reputation: 564801
This works fine. C# and C++ both support TCP and UDP network connections, in many flavors. Either would work fine for the client or server.
The main issues you'll need to watch for are deciding how to transmit your data, and making sure that any packets you pass through the wire are serialized/deserialized the same way.
This would be simpler if you were to use the same language (or at least libraries) on both sides, ie: if you used C++/CLI for the server, and stuck with some of the same managed .NET tools for working with data transmission.
Upvotes: 5
Reputation: 5853
If it is running all in one windows domain, you might consider DCOM. Otherwise, I'd go for web services (SOAP toolkit for C++) or maybe REST.
Upvotes: 0