コード例 #1
0
        /// <summary>
        /// Connect to the Server in the Bookmark using the UserInfo from the
        /// bookmark as well.
        /// </summary>
        /// <param name="bookmark">The info about Server and
        /// UserInformation.</param>
        public void Connect(Bookmark bookmark)
        {
            commandSocket = new SecureSocket();
            commands = new Commands(commandSocket);
            lagHandler = new LagHandler();

            try {
                if (bookmark != null) {
                    commandSocket.MessageReceived += messages.MessageReceived;

                    commandSocket.Connect(bookmark.Server);
                    commands.Hello(bookmark.Server.MachineName, bookmark.Server.ServerPort, bookmark.Server.ServerName);
                    mCurrentBookmark = bookmark;

                    messages.PingReplyEvent += lagHandler.OnPingReceived;
                    commands.PingSentEvent += lagHandler.OnPingSent;
                } else {
                    //TODO: Handle error
                    Debug.WriteLine("CONNECTIONMANAGER -> Connect: Trying to connect to a null bookmark.");
                }
            } catch (ConnectionException ce) {
                ce.Bookmark = bookmark;
                throw (ce);
            }
        }
コード例 #2
0
ファイル: Commands.cs プロジェクト: karlbohlmark/SharpWired
 /// <summary>Constructor</summary>
 public Commands(SecureSocket socket)
 {
     this.socket = socket;
 }