Total-to-point communication with Winsock

xiaoxiao2021-03-06  112

w

The INSOCK control is a new function of VB5.0, which solves the problem of failing to implement point-to-point communication between applications in the network when applying VB programming. Winsock uses TCP protocols and UDP protocols to establish and maintain a connection to a remote computer, and can be exchanged in real time before the connection ends. The user can connect to a remote computer only by setting the attribute and can easily connect to a remote computer, and only two commands can be exchanged. When using the TCP protocol, if you need to create a client application, you must identify the name or IP address of the server. The communication port of the application will carefully monitor the message issued by the other party, which is a guarantee for the system for reliable connection. Once the connection occurs, any party can send and receive data through SendData, and separating its own data with GetData. When transferring data, you need to set the client's localport property. The server only needs to set the RemoteHost property as the address of the client Ethernet, and set the same port address as the client localport property, and start sending messages with the SendData method. . The client separates the sent information through the DataArrival event in the GetData event. A Winsock control allows the local computer to connect to remote computers, using UDP or TCP protocols, and both protocols can create clients and server applications. When using the Winsock control, the communication between communication needs to select the same protocol. The TCP protocol applies to data files that transmit large capacity and require security assurance; the UDP protocol is applicable to the case where there are many subordinate communications, or the established connection is more and time-change, especially when the data is small. . You can use the Winsock1.Protocol = SCKTCPPROTOCOL method when setting, first you want to find your computer name and add it to Winsock's localhost properties. When you create an application, you first want to make sure that you build or server services, only the created server application starts working, and enter the listening state, the client application starts establishing the connection, entering the normal communication status. The author has established an application, and its function is when the client's mouse moves, the server application can display the position of the mouse in real time.

转载请注明原文地址:https://www.9cbs.com/read-100191.html

New Post(0)