public bool Connect(string ipAddress, int port) { try { IPAddress ip = IPAddress.Parse(ipAddress); tcpClient.Connect(ipAddress, port); networkStream = tcpClient.GetStream(); reader = new BinaryReader(networkStream, Encoding.UTF8); writer = new BinaryWriter(networkStream, Encoding.UTF8); formatter = new BinaryFormatter(); updateChatWindowDelegate = new UpdateChatWindowDelegate(UpdateChatWindow); gameUpdateDelegate = new GameUpdateDelegate(XO_GameUpdate); tcpThread = new Thread(new ThreadStart(ProcessServerResponse)); tcpThread.Start(); UdpThread = new Thread(new ThreadStart(UdpProcessServerResponse)); UdpThread.Start(); udpEndPoint = new IPEndPoint(ip, port); udpSocket.Connect(udpEndPoint); } catch (Exception e) { chatWindow.Text += "{0} Exception Caught: " + e + "\n"; return(false); } connected = true; return(true); }
public ClientForm(SimpleClient client) { _client = client; InitializeComponent(); _updateChatWindowDelgate = new UpdateChatWindowDelegate(UpdateChatWindow); ControlSelect(SubmitText); }
public ClientForm(object _client) { InitializeComponent(); _updateChatWindowDelegate = new UpdateChatWindowDelegate(UpdateChatWindow); _updateConnectedClientsDelegate = new UpdateConnectedClientsDelegate(UpdateClientListBox); Client = (SimpleClient)_client; inputChat.Select(); }
public Form1() { udpSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); IPEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 4444); udpSocket.Connect(IPEndPoint); formatter = new BinaryFormatter(); tcpClient = new TcpClient(); updateChatWindowDelegate = new UpdateChatWindowDelegate(UpdateChatWindow); InitializeComponent(); }
public ChatWindow(SimpleClient client) { InitializeComponent(); _updateChatWindowDelegate = new UpdateChatWindowDelegate(UpdateChatWindow); _clearChatWindowDelegate = new ClearChatWindowDelegate(ClearChatWindow); _client = client; if (messageBox.CanSelect) { messageBox.Select(); } }
public ClientForm(SimpleClient.SimpleClient client) { InitializeComponent(); updateChatWindowDelegate = new UpdateChatWindowDelegate(UpdateChatWindow); updateClientListBoxDeletage = new UpdateClientListBoxDelegate(UpdateClientListBox); Client = client; InputMessage.Select(); button2.Enabled = false; comboBox1.Enabled = false; button3.Enabled = false; isConnected = false; }
public ChatClient() { tcpClient = new TcpClient(); _updateChatWindowDelegate = new UpdateChatWindowDelegate(UpdateChatWindow); InitializeComponent(); }
public Form1(Manager manager) { Manager = manager; InitializeComponent(); updateChatWindowDelegate += new UpdateChatWindowDelegate(UpdateChatWindow); }