Connect() public method

Connects the client to the server
public Connect ( ) : bool
return bool
示例#1
0
        public Form1()
        {
            InitializeComponent();
            _client = new Networking.Client("127.0.0.1", 10250);
            _client.Connect();

            FormClosing += Form1_FormClosing;
        }
示例#2
0
 private void btnReconnect_Click(object sender, EventArgs e)
 {
     _client = new Client("127.0.0.1", 10250);
     if(_client.Connect()) {
         MessageBox.Show("Connected");
     } else {
         MessageBox.Show("Failed");
     }
 }
示例#3
0
 public FormMain()
 {
     InitializeComponent();
     _client = new Client("127.0.0.1", 10250);
     if (!_client.Connect()) {
         _client = null;
         return;
     }
     _client.Disconnected += Client_Disconnected;
     _client.MessageReceived += Client_MessageReceived;
     FormClosing += FormMain_FormClosing;
 }