This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

c6670 UDP 接收数据问题



recv( SOCKET s, void *pbuf, int size, int flags );该函数是从一块缓存区把数据拷贝到pbuf区域。我想问一下该缓存区的地址是怎么确定呢?

还有就是用sendto()发送数据过来,sendto()发送一次,我就必须用recv()函数接收一次吗?

  • 每个socket都会有一个对应的file descriptor,其中有对应的buffer,数据接收是存放在socket中,然后从指定的socket copy到外部指定pbuf;发送和接收是独立的,你在需要的时候调用recv接收获取数据即可。

    参考NDK doc目录下的NDK user guide 及API user guide。