示例#1
0
    //overload previous method with point of network interface to push packet
    public void SendMessageViaNet(NetwInterface _netInterface,MsgPacket _msgPacket)
    {
        _msgPacket._packagenum = PackageCounter++;
        // serialize
            byte []MyData;
            System.IO.MemoryStream MyMemoryStream;
            MyMemoryStream =  new System.IO.MemoryStream();
            BinaryFormatter formatter = new BinaryFormatter();

            formatter.Serialize(MyMemoryStream, _msgPacket);
            MyData = MyMemoryStream.ToArray();

        // SendTo net

            _netInterface.Send(MyData);
    }