SOCKET programming model for instance parsing (2)

Source: Internet
Author: User

The following is the client source code of the synchronous chat program. For some of the processes, refer to the server source code.
Using System;
Using System. Drawing;
Using System. Collections;
Using System. ComponentModel;
Using System. Windows. Forms;
Using System. Data;
Using System. Net;
Using System. Net. Sockets;
Using System. Threading;
Using System. Text;
Namespace chat _ socket_client
{
/// <Summary>
/// Summary of Form1.
/// </Summary>
Public class Form1: System. Windows. Forms. Form
{
Private System. Windows. Forms. Label label4;
Private System. Windows. Forms. Label label3;
Private System. Windows. Forms. Label label2;
Private System. Windows. Forms. Label label1;
Private System. Windows. Forms. Button btnStop;
Private System. Windows. Forms. Button btnSend;
Private System. Windows. Forms. TextBox txtPort;
Private System. Windows. Forms. TextBox txtServer;
Private System. Windows. Forms. RichTextBox rtbSend;
Private System. Windows. Forms. RichTextBox rtbReceive;
Private System. Windows. Forms. StatusBar statusBar1;
Private System. Windows. Forms. Button btnConnect;
Private IPAddress hostIPAddress;
Private IPEndPoint Server;
Private Socket sock;
/// <Summary>
/// Required designer variables.
/// </Summary>
Private System. ComponentModel. Container components = null;
Public Form1 ()
{
//
// Required for Windows Form Designer support
//
InitializeComponent ();
//
// TODO: add Any constructor code after InitializeComponent calls
//
}
/// <Summary>
/// Clear all resources in use.
/// </Summary>
Protected override void Dispose (bool disposing)
{
If (disposing)
{
If (components! = Null)
{
Components. Dispose ();
}
}
Base. Dispose (disposing );
}
# Region code generated by Windows Form Designer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.