private void Playgame_Load(object sender, EventArgs e) { client = new NetComm.Client(); //Initialize the client object //Adding event handling methods for the client client.Connected += new NetComm.Client.ConnectedEventHandler(client_Connected); client.Disconnected += new NetComm.Client.DisconnectedEventHandler(client_Disconnected); client.DataReceived += new NetComm.Client.DataReceivedEventHandler(client_DataReceived); client.Connect(strIPAddress, numPortData, nameClient); //Connecting to the host (on the same machine) with port 5000 and ID is variable name in contrustor function }
NetComm.Client client; //The client object used for the communication private void MainDisplay_Load(object sender, EventArgs e) { client = new NetComm.Client(); //Initialize the client object //Adding event handling methods for the client client.Connected += new NetComm.Client.ConnectedEventHandler(client_Connected); client.Disconnected += new NetComm.Client.DisconnectedEventHandler(client_Disconnected); client.DataReceived += new NetComm.Client.DataReceivedEventHandler(client_DataReceived); //Connecting to the host client.Connect("localhost", 2020, "Jack"); //Connecting to the host (on the same machine) with port 2020 and ID "Jack" }
public Form1(NetComm.Client client) { _client = client; InitializeComponent(); }