//线程运行机制
public void run( )
{
while(true)
{
try
{
sout.writeChars( textBox_send.get_Text( )) ;
//将缓冲区内容向输出流发送
if( send )
sout.flush() ;
}
catch( Exception e )
{
MessageBox.Show( e.ToString( )) ;
}
}
}
//析构方法
public void finalize( )
{
try
{
//停止ServerSocket服务
server.close( ) ;
}
catch( IOException e )
{
MessageBox.Show( e.ToString( )) ;
}
}
public ServerSocketForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/**
* Clean up any resources being used.
*/
protected void Dispose(boolean disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
super.Dispose(disposing);
}
#region Windows Form Designer generated code
/**
* Required method for Designer support - do not modify
* the contents of this method with the code editor.
*/
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.button_send = new System.Windows.Forms.Button();
this.button_link = new System.Windows.Forms.Button();
this.checkBox_ME = new System.Windows.Forms.CheckBox();
this.checkBox_DME = new System.Windows.Forms.CheckBox();
this.button_unlink = new System.Windows.Forms.Button();
this.button_close = new System.Windows.Forms.Button();
this.textBox_send = new System.Windows.Forms.TextBox();
this.textBox_receive = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label1
//
this.label1.set_Location(new System.Drawing.Point(8, 16));
this.label1.set_Name("label1");
this.label1.set_Size(new System.Drawing.Size(128, 23));
this.label1.set_TabIndex(0);
this.label1.set_Text("输入发送数据(二进制)");
//
// label2
//
this.label2.set_Location(new System.Drawing.Point(8, 152));
this.label2.set_Name("label2");
this.label2.set_Size(new System.Drawing.Size(56, 23));
this.label2.set_TabIndex(1);
this.label2.set_Text("返回信息");
//
// button_send
//
this.button_send.set_Location(new System.Drawing.Point(216, 112));
this.button_send.set_Name("button_send");
this.button_send.set_TabIndex(6);
this.button_send.set_Text("发送");
this.button_send.add_Click( new System.EventHandler(this.button_send_Click) );
//
// button_link
//
this.button_link.set_Location(new System.Drawing.Point(8, 112));
this.button_link.set_Name("button_link");
this.button_link.set_TabIndex(7);
this.button_link.set_Text("建立连接");
this.button_link.add_Click( new System.EventHandler(this.button_link_Click) );
//