コード例 #1
0
        public static void SendBackPositions(PositionList received)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                received.WriteTo(ms);
                Socket tempSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                IPEndPoint replyEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), replyPort);
                ms.Position = 0;
                tempSocket.SendTo(received.ToByteArray(), replyEndPoint);
                tempSocket.Close();
            }

            Console.WriteLine("Data sent!");
            StartBoth.ListeningMessage();
            StartBoth._Positionlistening = false;
        }