摘要 |
A method and device for accessing data through a stack of Transmission Control Protocol and Internetwork Protocols (TCP/IP). The method includes: obtaining an identifier that designates a plurality of UDP data packets in the User Datagram Protocol (UDP) of the TCP/IP stack; obtaining a total length of UDP data packets to be accessed; obtaining data in the protocol stack according the total length of foregoing designated UDP data packets; copying the designated UDP data packets to a user state. The method uses the identifier to access a plurality of UDP data packets and use the length to determine the number of accessible UDP data packets whereby it can access a plurality of UDP data packet each time. Moreover, it reduces the frequency of system calls when accessing an equal number of UDP data packets and shortens the time of system calls. Therefore, it improves the network I/O capacity.
|