After four days of National Day, my wife went to Beijing for a business trip last night and arrived there at noon today. It seems that the conditions are not as good as we thought, and I miss it very much. today, let's calm down and think about my development in BS. My wife has forgotten many things in Cs and has been developing in CS. Speaking of technology, I feel a little unfamiliar, open the computer and look at the previous projects, look at the "three in one system" of the original company in Shanghai, and look at the MES projects of the company's wife. They are all servers and clients, the two implementation methods are different (TCP/IP, remoting, and so on). The concept of Windows communication frameworks during company training mainly refers to the interconnectivity between multiple projects, it is also implemented through different connection methods (TCP/IP, remoting, MSMQ, and WebService in BS ). however, the use of WCF technology is very rare, so the current CS still uses the front TCP/IP and remoting connection technology. I read a project today and learned the following:
Judge IP Address
1 Private IPaddress myip = IPaddress. parse ( " 127.0.0.1 " );
2
3 Try
4 {
5Myip=IPaddress. parse (textbox1.text );
6
7}
8 Catch {MessageBox. Show ("The IP address format you entered is incorrect. Please enter it again!");} Connect to a remote host
1 Private Ipendpoint myserver;
2 Private Socket sock;
3 Myserver = New Ipendpoint (myip, int32.parse (textbox2.text ));
4 Sock = New Socket (addressfamily. InterNetwork, sockettype. Stream, protocoltype. TCP );
5
6 Sock. Connect (myserver );
To directly disconnect a connection: sock. Close ();
I have never used the numericupdown control. Today, I see a project used as an IP address.
Progressbar is used to display the progress of an event. It is a bit like Ajax in BS. It is also easy to use. It has a minimum attribute and a maximum attribute to set the start point,Obtain basic information
1 // Obtain host information downstream
2 Iphostentry myhost = DNS. gethostbyaddress (myip );
3 // Obtain the Host Name and convert it to a string
4 String CC = Myhost. hostname. tostring ();
You can save the data in RichTextBox in various formats: Save format
1 Streamwriter SW = Null ;
2 Savefiledialog1.filter = " Text File (*. txt) | *. txt | Word Document (*. Doc) | *. Doc | all files (*. *) | *.* " ;
3 If (Savefiledialog1.showdialog () = Dialogresult. OK)
4 {
5 Try
6 {
7SW=NewStreamwriter (savefiledialog1.filename,False, System. Text. encoding. Unicode );
8Sw. Write (richtextbox1.text );}
9 Catch (Exception excep) {MessageBox. Show (excep. Message );}
10 Finally {If(SW! =Null){Sw. Close ();}
11} // Corresponds to finally {
12
13 }
View saved information: Read relevant information
1 String AA;
2 Try
3 {Openfiledialog1.filter = " Text File (*. txt) | *. txt | Word Document (*. Doc) | *. Doc | all files (*. *) | *.* " ;
4 If (Openfiledialog1.showdialog () = Dialogresult. OK)
5 {
6
7 AA = File. opentext (openfiledialog1.filename). readtoend ();
8 Richtextbox1.appendtext (AA );
9 File. opentext (openfiledialog1.filename). Close ();
10
11 }
12 } // Try
13 Catch (Exception ee) {MessageBox. Show (EE. Message );}
Stop doing something: application. Exit ();