Esempio n. 1
0
        public void ConnectAsync(OnClientConnectedCallback callback) {
            if (socket.Connected) {
                if (callback != null) {
                    callback();
                }
            }
            else {
                socket.BeginConnect(
                    this.Endpoint.CreateIpEndpoint(),
                    (ia) => {
                        socket.EndConnect(ia);

                        if (callback != null) {
                            callback();
                        }
                    },
                    null);
            }
        }
Esempio n. 2
0
        public void ConnectAsync(OnClientConnectedCallback callback)
        {
            if (socket.Connected)
            {
                if (callback != null)
                {
                    callback();
                }
            }
            else
            {
                socket.BeginConnect(
                    this.Endpoint.CreateIpEndpoint(),
                    (ia) => {
                    socket.EndConnect(ia);

                    if (callback != null)
                    {
                        callback();
                    }
                },
                    null);
            }
        }