NLog.TcpClientSocket.onConnected C# (CSharp) 메소드

onConnected() 공개 메소드

public onConnected ( IAsyncResult ar ) : void
ar IAsyncResult
리턴 void
        void onConnected(IAsyncResult ar)
        {
            var socket = (Socket)ar.AsyncState;
            try {
                socket.EndConnect(ar);
                isConnected = true;
                IPEndPoint clientEndPoint = (IPEndPoint)socket.RemoteEndPoint;
                _log.Info(string.Format("Connected to {0}:{1}",
                    clientEndPoint.Address, clientEndPoint.Port));
                if (OnConnect != null) {
                    OnConnect(this, null);
                }
                startReceiving(socket);
            } catch (Exception ex) {
                _log.Warn(ex.Message);
                triggerOnDisconnect();
            }
        }