摘要 |
The present invention relates to the field of network technology, specifically to a method for achieving P2P communication on webpage. The method includes the steps of: 1) accessing a webpage by a user, calling an interface of a flash to connect with a socket server, connecting with a stratus server to acquire a key and monitoring received messages by the flash; 2) sending a username and the key of a source user to the socket server by the flash and storing the username and the key of the source user by the socket server; 3) acquiring the key of the target user from the socket server and sending a message out via the netconnection and the key of the target user by the flash on the webpage of the source user; 4) displaying the message on the webpage of the target user after the flash of the webpage of the target user receives the message. The method can implement p2p communication on webpage, establish connection among the users directly, reduce the pressure on the bandwidth of the server, thereby enhancing communication efficiency and network utilization.
|