📄 apr__network__io_8h-source.html
字号:
00459 <span class="comment"> * @param len On entry, the number of bytes to send; on exit, the number</span>
00460 <span class="comment"> * of bytes sent.</span>
00461 <span class="comment"> * @remark</span>
00462 <span class="comment"> * <PRE></span>
00463 <span class="comment"> * This functions acts like a blocking write by default. To change </span>
00464 <span class="comment"> * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK</span>
00465 <span class="comment"> * socket option.</span>
00466 <span class="comment"> *</span>
00467 <span class="comment"> * It is possible for both bytes to be sent and an error to be returned.</span>
00468 <span class="comment"> *</span>
00469 <span class="comment"> * APR_EINTR is never returned.</span>
00470 <span class="comment"> * </PRE></span>
00471 <span class="comment"> */</span>
00472 APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const <span class="keywordtype">char</span> *buf,
00473 apr_size_t *len);
00474 <span class="comment"></span>
00475 <span class="comment">/**</span>
00476 <span class="comment"> * Send multiple packets of data over a network.</span>
00477 <span class="comment"> * @param sock The socket to send the data over.</span>
00478 <span class="comment"> * @param vec The array of iovec structs containing the data to send </span>
00479 <span class="comment"> * @param nvec The number of iovec structs in the array</span>
00480 <span class="comment"> * @param len Receives the number of bytes actually written</span>
00481 <span class="comment"> * @remark</span>
00482 <span class="comment"> * <PRE></span>
00483 <span class="comment"> * This functions acts like a blocking write by default. To change </span>
00484 <span class="comment"> * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK</span>
00485 <span class="comment"> * socket option.</span>
00486 <span class="comment"> * The number of bytes actually sent is stored in argument 3.</span>
00487 <span class="comment"> *</span>
00488 <span class="comment"> * It is possible for both bytes to be sent and an error to be returned.</span>
00489 <span class="comment"> *</span>
00490 <span class="comment"> * APR_EINTR is never returned.</span>
00491 <span class="comment"> * </PRE></span>
00492 <span class="comment"> */</span>
00493 APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock,
00494 const struct iovec *vec,
00495 apr_int32_t nvec, apr_size_t *len);
00496 <span class="comment"></span>
00497 <span class="comment">/**</span>
00498 <span class="comment"> * @param sock The socket to send from</span>
00499 <span class="comment"> * @param where The apr_sockaddr_t describing where to send the data</span>
00500 <span class="comment"> * @param flags The flags to use</span>
00501 <span class="comment"> * @param buf The data to send</span>
00502 <span class="comment"> * @param len The length of the data to send</span>
00503 <span class="comment"> */</span>
00504 APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock,
00505 apr_sockaddr_t *where,
00506 apr_int32_t flags, const <span class="keywordtype">char</span> *buf,
00507 apr_size_t *len);
00508 <span class="comment"></span>
00509 <span class="comment">/**</span>
00510 <span class="comment"> * @param from The apr_sockaddr_t to fill in the recipient info</span>
00511 <span class="comment"> * @param sock The socket to use</span>
00512 <span class="comment"> * @param flags The flags to use</span>
00513 <span class="comment"> * @param buf The buffer to use</span>
00514 <span class="comment"> * @param len The length of the available buffer</span>
00515 <span class="comment"> */</span>
00516
00517 APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from,
00518 apr_socket_t *sock,
00519 apr_int32_t flags, <span class="keywordtype">char</span> *buf,
00520 apr_size_t *len);
00521
00522 #if APR_HAS_SENDFILE || defined(DOXYGEN)
00523 <span class="comment"></span>
00524 <span class="comment">/**</span>
00525 <span class="comment"> * Send a file from an open file descriptor to a socket, along with </span>
00526 <span class="comment"> * optional headers and trailers</span>
00527 <span class="comment"> * @param sock The socket to which we're writing</span>
00528 <span class="comment"> * @param file The open file from which to read</span>
00529 <span class="comment"> * @param hdtr A structure containing the headers and trailers to send</span>
00530 <span class="comment"> * @param offset Offset into the file where we should begin writing</span>
00531 <span class="comment"> * @param len (input) - Number of bytes to send from the file </span>
00532 <span class="comment"> * (output) - Number of bytes actually sent, </span>
00533 <span class="comment"> * including headers, file, and trailers</span>
00534 <span class="comment"> * @param flags APR flags that are mapped to OS specific flags</span>
00535 <span class="comment"> * @remark This functions acts like a blocking write by default. To change </span>
00536 <span class="comment"> * this behavior, use apr_socket_timeout_set() or the</span>
00537 <span class="comment"> * APR_SO_NONBLOCK socket option.</span>
00538 <span class="comment"> * The number of bytes actually sent is stored in the len parameter.</span>
00539 <span class="comment"> * The offset parameter is passed by reference for no reason; its</span>
00540 <span class="comment"> * value will never be modified by the apr_socket_sendfile() function.</span>
00541 <span class="comment"> */</span>
00542 APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock,
00543 apr_file_t *file,
00544 apr_hdtr_t *hdtr,
00545 apr_off_t *offset,
00546 apr_size_t *len,
00547 apr_int32_t flags);
00548
00549 #endif <span class="comment">/* APR_HAS_SENDFILE */</span>
00550 <span class="comment"></span>
00551 <span class="comment">/**</span>
00552 <span class="comment"> * Read data from a network.</span>
00553 <span class="comment"> * @param sock The socket to read the data from.</span>
00554 <span class="comment"> * @param buf The buffer to store the data in. </span>
00555 <span class="comment"> * @param len On entry, the number of bytes to receive; on exit, the number</span>
00556 <span class="comment"> * of bytes received.</span>
00557 <span class="comment"> * @remark</span>
00558 <span class="comment"> * <PRE></span>
00559 <span class="comment"> * This functions acts like a blocking read by default. To change </span>
00560 <span class="comment"> * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK</span>
00561 <span class="comment"> * socket option.</span>
00562 <span class="comment"> * The number of bytes actually received is stored in argument 3.</span>
00563 <span class="comment"> *</span>
00564 <span class="comment"> * It is possible for both bytes to be received and an APR_EOF or</span>
00565 <span class="comment"> * other error to be returned.</span>
00566 <span class="comment"> *</span>
00567 <span class="comment"> * APR_EINTR is never returned.</span>
00568 <span class="comment"> * </PRE></span>
00569 <span class="comment"> */</span>
00570 APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock,
00571 <span class="keywordtype">char</span> *buf, apr_size_t *len);
00572 <span class="comment"></span>
00573 <span class="comment">/**</span>
00574 <span class="comment"> * Setup socket options for the specified socket</span>
00575 <span class="comment"> * @param sock The socket to set up.</span>
00576 <span class="comment"> * @param opt The option we would like to configure. One of:</span>
00577 <span class="comment"> * <PRE></span>
00578 <span class="comment"> * APR_SO_DEBUG -- turn on debugging information </span>
00579 <span class="comment"> * APR_SO_KEEPALIVE -- keep connections active</span>
00580 <span class="comment"> * APR_SO_LINGER -- lingers on close if data is present</span>
00581 <span class="comment"> * APR_SO_NONBLOCK -- Turns blocking on/off for socket</span>
00582 <span class="comment"> * When this option is enabled, use</span>
00583 <span class="comment"> * the APR_STATUS_IS_EAGAIN() macro to</span>
00584 <span class="comment"> * see if a send or receive function</span>
00585 <span class="comment"> * could not transfer data without</span>
00586 <span class="comment"> * blocking.</span>
00587 <span class="comment"> * APR_SO_REUSEADDR -- The rules used in validating addresses</span>
00588 <span class="comment"> * supplied to bind should allow reuse</span>
00589 <span class="comment"> * of local addresses.</span>
00590 <span class="comment"> * APR_SO_SNDBUF -- Set the SendBufferSize</span>
00591 <span class="comment"> * APR_SO_RCVBUF -- Set the ReceiveBufferSize</span>
00592 <span class="comment"> * </PRE></span>
00593 <span class="comment"> * @param on Value for the option.</span>
00594 <span class="comment"> */</span>
00595 APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock,
00596 apr_int32_t opt, apr_int32_t on);
00597 <span class="comment"></span>
00598 <span class="comment">/**</span>
00599 <span class="comment"> * Setup socket timeout for the specified socket</span>
00600 <span class="comment"> * @param sock The socket to set up.</span>
00601 <span class="comment"> * @param t Value for the timeout.</span>
00602 <span class="comment"> * <PRE></span>
00603 <span class="comment"> * t > 0 -- read and write calls return APR_TIMEUP if specified time</span>
00604 <span class="comment"> * elapsess with no data read or written</span>
00605 <span class="comment"> * t == 0 -- read and write calls never block</span>
00606 <span class="comment"> * t < 0 -- read and write calls block</span>
00607 <span class="comment"> * </PRE></span>
00608 <span class="comment"> */</span>
00609 APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock,
00610 apr_interval_time_t t);
00611 <span class="comment"></span>
00612 <span class="comment">/**</span>
00613 <span class="comment"> * Query socket options for the specified socket</span>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -