tcp.hpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #ifndef __ZMQ_TCP_HPP_INCLUDED__
4 #define __ZMQ_TCP_HPP_INCLUDED__
5 
6 #include "fd.hpp"
7 
8 namespace zmq
9 {
10 class tcp_address_t;
11 struct options_t;
12 
13 // Tunes the supplied TCP socket for the best latency.
14 int tune_tcp_socket (fd_t s_);
15 
16 // Sets the socket send buffer size.
17 int set_tcp_send_buffer (fd_t sockfd_, int bufsize_);
18 
19 // Sets the socket receive buffer size.
20 int set_tcp_receive_buffer (fd_t sockfd_, int bufsize_);
21 
22 // Tunes TCP keep-alives
24  int keepalive_,
25  int keepalive_cnt_,
26  int keepalive_idle_,
27  int keepalive_intvl_);
28 
29 // Tunes TCP max retransmit timeout
30 int tune_tcp_maxrt (fd_t sockfd_, int timeout_);
31 
32 // Writes data to the socket. Returns the number of bytes actually
33 // written (even zero is to be considered to be a success). In case
34 // of error or orderly shutdown by the other peer -1 is returned.
35 int tcp_write (fd_t s_, const void *data_, size_t size_);
36 
37 // Reads data from the socket (up to 'size' bytes).
38 // Returns the number of bytes actually read or -1 on error.
39 // Zero indicates the peer has closed the connection.
40 int tcp_read (fd_t s_, void *data_, size_t size_);
41 
42 void tcp_tune_loopback_fast_path (fd_t socket_);
43 
44 void tune_tcp_busy_poll (fd_t socket_, int busy_poll_);
45 
46 // Resolves the given address_ string, opens a socket and sets socket options
47 // according to the passed options_. On success, returns the socket
48 // descriptor and assigns the resolved address to out_tcp_addr_. In case of
49 // an error, retired_fd is returned, and the value of out_tcp_addr_ is undefined.
50 // errno is set to an error code describing the cause of the error.
51 fd_t tcp_open_socket (const char *address_,
52  const options_t &options_,
53  bool local_,
54  bool fallback_to_ipv4_,
55  tcp_address_t *out_tcp_addr_);
56 }
57 
58 #endif
data_
StringPiece data_
Definition: bytestream_unittest.cc:60
zmq::set_tcp_receive_buffer
int set_tcp_receive_buffer(fd_t sockfd_, int bufsize_)
Definition: tcp.cpp:62
zmq
Definition: zmq.hpp:229
zmq::set_tcp_send_buffer
int set_tcp_send_buffer(fd_t sockfd_, int bufsize_)
Definition: tcp.cpp:53
zmq::tcp_tune_loopback_fast_path
void tcp_tune_loopback_fast_path(fd_t socket_)
Definition: tcp.cpp:293
s_
std::string s_
Definition: gmock-matchers_test.cc:4128
zmq::tune_tcp_maxrt
int tune_tcp_maxrt(fd_t sockfd_, int timeout_)
Definition: tcp.cpp:160
fd.hpp
zmq::tune_tcp_keepalives
int tune_tcp_keepalives(fd_t s_, int keepalive_, int keepalive_cnt_, int keepalive_idle_, int keepalive_intvl_)
Definition: tcp.cpp:71
zmq::tune_tcp_socket
int tune_tcp_socket(fd_t s_)
Definition: tcp.cpp:30
zmq::tcp_open_socket
fd_t tcp_open_socket(const char *address_, const options_t &options_, bool local_, bool fallback_to_ipv4_, tcp_address_t *out_tcp_addr_)
Definition: tcp.cpp:332
zmq::tcp_write
int tcp_write(fd_t s_, const void *data_, size_t size_)
Definition: tcp.cpp:186
fd_t
zmq_fd_t fd_t
Definition: libzmq/tests/testutil.hpp:98
zmq::tune_tcp_busy_poll
void tune_tcp_busy_poll(fd_t socket_, int busy_poll_)
Definition: tcp.cpp:317
zmq::tcp_read
int tcp_read(fd_t s_, void *data_, size_t size_)
Definition: tcp.cpp:245
options_
DebugStringOptions options_
Definition: src/google/protobuf/descriptor.cc:2410


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:59