PR_SendTo 编辑
Sends bytes a socket to a specified destination.
Syntax
#include <prio.h> /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRInt32 PR_SendTo( /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRFileDesc *fd, const void *buf, /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRInt32 amount, /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRIntn flags, const /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 to be sent.
amount
- The size of
buf
(in bytes). flags
- This obsolete parameter must always be zero.
addr
- A pointer to the address of the destination.
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:
- A positive number indicates the number of bytes successfully sent.
- The value -1 indicates a failure. The reason for the failure can be obtained by calling
/wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PR_GetError
.
Description
PR_SendTo
sends a specified number of bytes from a socket to the specified destination address. The calling thread blocks until all bytes are sent, a timeout has occurred, or there is an error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论