Beispiel #1
0
        private void ResolveCallback(IAsyncResult ar)
        {
            Resolve resolve = (Resolve)ar.AsyncState;

            try
            {
                IPHostEntry hostEntry = resolve.EndInvoke(ar);
                UpdateState(SocketState.Connecting);
                IPEndPoint endPoint = new IPEndPoint(hostEntry.AddressList[0], port);
                socket = Network.CreateSocket();
                socket.BeginConnect(endPoint, ConnectCallback, null);
            }
            catch (Exception e)
            {
                OnError(new SocketErrorEventArgs(e));
            }
        }