Exemplo n.º 1
0
        /// <summary>
        /// Connects to the remote server as a client.
        /// </summary>
        /// <param name="address"></param>
        public void Connect(bool async = false)
        {
            if (WSServer != null)
            {
                throw new Exception("Cannot both be a server and a client." +
                                    " Please use Connect if you are connecting to a server or Listen to create a server.");
            }

            MakeClient();

            if (async)
            {
                WS.ConnectAsync();
            }
            else
            {
                WS.Connect();
            }

            DataSocket.Initialize();
        }