Theory
1.1. Customer / Server Mode Application Design Current web application architecture can usually be divided into customer-server mode, browser-server mode, and P2P mode. In the enterprise instant messaging system, for the centralized management of information, the customer-server mode is more suitable. Therefore, in this system, this mode is used to save user registration information and most of the other information on the server side, so no matter where to log in, do not have to store related information on the client, the same user can log in to the correct server, Get unique data and information representation.
1.2. NET implements the UDP protocol The system uses the UDP (User Data News Agreement) to implement the underlying network communication.
The UDPClient classes in the .NET system.net.sockets namespace provide some simple methods for sending and receiving unconnected UDP datagrams in blocking synchronization mode.
Because UDP is no connection transmit protocol, it is not necessary to establish a remote host connection before sending and receiving data. But you can choose to create a default remote host using one of the following two methods:
Use the remote hostname and port number as the parameter to create an instance of the UDPCLIENT class.
Create an instance of a UDPCLIENT class, then call the Connect method.
You can send data to a remote device using any of the sending methods provided in UDPCLIENT. Use the Receive method to receive data from the remote host.
The udpclient method also allows you to send and receive multiple broadcast datagrams. Using the JoinMulticastGroup method can book UDPClient to make multiple broadcast groups. Use the DropMulticastGroup method to cancel the subscription to udpclient from multiple broadcast groups.
1.3. The XML object serialization serialization in .NET is the process of converting the object state to a fully or transmitted format. The relative sequence is reverse selecente, and it converts the stream to an object. These two processes are combined to make data easily store and transmit.
.NET Framework provides two serialization techniques:
L binary serialization maintains the type of assault, which is useful for the status of retention objects between applications. For example, by sequentially serializing the object to the clipboard, the object can be shared between different applications. You can serve the object to stream, disk, memory, and network, and more. Remote processing uses serialization "Value" to pass objects between computers or application domains.
l XML serialization is only serialized public attributes and fields and does not reserve the type of assay. This is useful when you want to provide or use data without limiting the application of the application. Since XML is an open standard, it is an attractive option for sharing data through web. SOAP is also an open standard, which makes it an attractive choice.
The system takes into account the needs of interoperability between scalability and applications, using XML to serialize objects, such as instant messaging, voice data, file data, etc.
XML serialization converts the public field and attributes or methods of the object to the XML stream (serialized) to conform to a specific XML schema definition language (XSD) document. XML serialization produces a strong type class and converts its public attributes and fields into a sequence format for storage or transmission purposes (in this case, XML).
Since XML is an open standard, no matter what platform is used, any application can process XML streams as needed. For example, XML Web Services created with ASP.NET uses the XMLSerializer class to deliver data between the XML Web Services applications on the entire Internet or Intranet. Conversely, the reverse sequenceage acquires such an XML stream and re-constructs the object.
XML serialization can also be used to sequence the object sequence to the XML stream that conforms to the SOAP specification. SOAP is an XML-based protocol that is designed to transfer process calls for use XML. 1.4. NET multi-threaded programming To enable applications to quickly respond to user operation, one of the most powerful ways between user events or even in user events, the most powerful way is to use multiple execution threads.
In the system implementation, in order to improve the client response speed, multi-threaded program design is used.
In the .NET framework, multi-threading is relatively simple. Namespace System.ThReading provides classes related to thread operations.
A process can create one or more threads to perform some program code associated with the process. Use ThreadStart to delegate specifying program code executed by threads. System.threading.Thread class is used to create and control threads, set their priority and get its status.
When you create a thread, you will use System.Threading.ThreadStart to create a new instance of the THREAD class as its unique parameter. However, threads do not start executing before calling the START method. After calling START, it will be executed from the first row of the method of trust from the ThreadStart.