PR_RecvFrom 编辑

Receives bytes from a socket and stores the sending peer's address.

Syntax

#include <prio.h>

/wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRInt32 PR_RecvFrom(
  /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRFileDesc *fd,
  void *buf,
  /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRInt32 amount,
  /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRIntn flags,
  /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRNetAddr *addr,
  /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRIntervalTime timeout);

Parameters

The function has the following parameters:

fd
A pointer to a /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRFileDesc object representing a socket.
buf
A pointer to a buffer containing the data received.
amount
The size of buf (in bytes).
flags
This obsolete parameter must always be zero.
addr
A pointer to the /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRNetAddr object that will be filled in with the address of the sending peer on return.
timeout
A value of type /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRIntervalTime specifying the time limit for completion of the receive operation.

Returns

The function returns one of the following values:

Description

PR_RecvFrom receives up to a specified number of bytes from socket, which may or may not be connected. The operation blocks until one or more bytes are transferred, a timeout has occurred, or there is an error. No more than amount bytes will be transferred. PR_RecvFrom is usually used with a UDP socket.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:95 次

字数:3256

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文