Ejemplo n.º 1
0
        public void Start()
        {
            dbHelper.Init();

            IPEndPoint e = new IPEndPoint(IPAddress.Any, portNum);
            UdpClient  u = new UdpClient(e);

            UdpState s = new UdpState();

            s.e = e;
            s.u = u;
            u.BeginReceive(new AsyncCallback(recvCompletion), s);
        }
Ejemplo n.º 2
0
        void recvCompletion(IAsyncResult ar)
        {
            UdpClient  u = (UdpClient)((UdpState)(ar.AsyncState)).u;
            IPEndPoint e = (IPEndPoint)((UdpState)(ar.AsyncState)).e;

            Byte[] receiveBytes  = u.EndReceive(ar, ref e);
            string receiveString = Encoding.ASCII.GetString(receiveBytes);

            OnRecv(receiveString);

            UdpState s = new UdpState();

            s.e = e;
            s.u = u;
            u.BeginReceive(new AsyncCallback(recvCompletion), s);
        }
Ejemplo n.º 3
0
        void recvCompletion(IAsyncResult ar)
        {
            UdpClient u = (UdpClient)((UdpState)(ar.AsyncState)).u;
            IPEndPoint e = (IPEndPoint)((UdpState)(ar.AsyncState)).e;
            Byte[] receiveBytes = u.EndReceive(ar, ref e);
            string receiveString = Encoding.ASCII.GetString(receiveBytes);

            OnRecv(receiveString);

            UdpState s = new UdpState();
            s.e = e;
            s.u = u;
            u.BeginReceive(new AsyncCallback(recvCompletion), s);
        }
Ejemplo n.º 4
0
        public void Start()
        {
            dbHelper.Init();

            IPEndPoint e = new IPEndPoint(IPAddress.Any, portNum);
            UdpClient u = new UdpClient(e);

            UdpState s = new UdpState();
            s.e = e;
            s.u = u;
            u.BeginReceive(new AsyncCallback(recvCompletion), s);
        }