DirectPlay - Write() question
in C#, is it possible to send data to write other than strings/ints? (Objects such as structs, classes, etc.).
If so, how do you typecast it so that it will compile?
Thanks!
Just to clarify, since I haven''t gotten a response yet:
When creating a NetworkPacket to send using DirectPlay I found you can write two things to the packet: 1) string 2) int
Example:
Is there a way to typecast it such that you can write a struct or class object?
Example (gives compile error):
Thanks in advanced.
Mike
When creating a NetworkPacket to send using DirectPlay I found you can write two things to the packet: 1) string 2) int
Example:
NetworkPacket packet = new NetworkPacket(); int x = 1; packet.Write("Hello there"); packet.Write(x); m_Client.Send(packet, 0, SendFlags.Sync SendFlags.NoLoopback);
Is there a way to typecast it such that you can write a struct or class object?
Example (gives compile error):
NetworkPacket packet = new NetworkPacket(); DataStruct myData = new DataStruct(); packet.Write(myData); // <-- How can i typecast this to work??? m_Client.Send(packet, 0, SendFlags.Sync SendFlags.NoLoopback);
Thanks in advanced.
Mike
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement