GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
tcp_sink.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2020 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_NETWORK_TCP_SINK_H
12 #define INCLUDED_NETWORK_TCP_SINK_H
13 
14 #include <gnuradio/network/api.h>
15 #include <gnuradio/sync_block.h>
16 
17 #define TCPSINKMODE_CLIENT 1
18 #define TCPSINKMODE_SERVER 2
19 
20 namespace gr {
21 namespace network {
22 
23 /*!
24  * \brief This block provides a TCP Sink block that supports
25  * both client and server modes.
26  * \ingroup networking_tools
27  *
28  * \details
29  * This block provides a TCP sink that supports both listening for
30  * inbound connections (server mode) and connecting to other applications
31  * (client mode) in order to send data from a GNU Radio flowgraph.
32  * The block supports both IPv4 and IPv6 with appropriate code determined
33  * by the address used. In server mode, if a client disconnects, the
34  * flowgraph will continue to execute. If/when a new client connection
35  * is established, data will then pick up with the current stream for
36  * transmission to the new client.
37  */
38 class NETWORK_API tcp_sink : virtual public gr::sync_block
39 {
40 public:
41  typedef std::shared_ptr<tcp_sink> sptr;
42 
43  /*!
44  * Build a tcp_sink block.
45  */
46  static sptr
47  make(size_t itemsize, size_t veclen, const std::string& host, int port, int sinkmode);
48 };
49 
50 } // namespace network
51 } // namespace gr
52 
53 #endif /* INCLUDED_NETWORK_TCP_SINK_H */
This block provides a TCP Sink block that supports both client and server modes.
Definition: tcp_sink.h:39
static sptr make(size_t itemsize, size_t veclen, const std::string &host, int port, int sinkmode)
std::shared_ptr< tcp_sink > sptr
Definition: tcp_sink.h:41
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define NETWORK_API
Definition: gr-network/include/gnuradio/network/api.h:19
GR_RUNTIME_API size_t itemsize(types::vector_type type)
GNU Radio logging wrapper.
Definition: basic_block.h:29