摘要 |
<p>A method for realizing a peer-to-peer (p2p) communication on a webpage is disclosed, which belongs to the field of network technology. The method comprises the following steps: 1) a user accesses the webpage and calls an interface of a flash to connect with a socket server, and the flash is connected with a stratus server, acquires a key, and monitors the received message; 2) the flash sends the username of a source user and the key to the socket server, and the socket server stores the username and the key; 3) the flash in the webpage of the source user acquires the key of a target user from the socket server, and sends the message by netconnection and the key; and 4) after the flash of the target user receives the message, the message is displayed on the webpage of the target user. The method can realize the p2p communication on the webpage, establish a connection between users directly, and lighten the bandwidth pressure of the server so as to improve the communication efficiency and network utilization ratio.</p> |