Data transmission method and devices for wifi network and terminal devices

The invention is applicable to the technical field of internet and provides data transmission method and devices for a wifi network, and terminal devices. The method includes the following steps: a first terminal device establishes communication connection with a second terminal device through a udp protocol; according to the communication connection, the first terminal device establishes socket connection with the second terminal device; and through the socket connection, the first terminal sends to-be-transmitted data to the second terminal. The data transmission method and devices for the wifi network enable data transmission to be carried out directly among terminal devices as long as the terminal devices are under the same wifi network so that dependency on a server is removed and a data transmission process does not need operations such as authentication and friend adding and the like and thus a data transmission process is simpler and rapid.