diff options
author | Andrej Rode <andrej.rode@ettus.com> | 2017-04-13 16:30:23 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-04-14 09:20:08 -0700 |
commit | 246c194740e21fda85ad1d406123e679e47d0c8c (patch) | |
tree | bf4c16719617a49253e53e283c763b17482beaab /host | |
parent | 9a2652361a4285f3d30be9f8c77930dfd26cd7b2 (diff) | |
download | uhd-246c194740e21fda85ad1d406123e679e47d0c8c.tar.gz uhd-246c194740e21fda85ad1d406123e679e47d0c8c.tar.bz2 uhd-246c194740e21fda85ad1d406123e679e47d0c8c.zip |
add windows get_local_port()
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/transport/udp_wsa_zero_copy.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/host/lib/transport/udp_wsa_zero_copy.cpp b/host/lib/transport/udp_wsa_zero_copy.cpp index c1a4f4db6..66af394a9 100644 --- a/host/lib/transport/udp_wsa_zero_copy.cpp +++ b/host/lib/transport/udp_wsa_zero_copy.cpp @@ -275,6 +275,16 @@ public: size_t get_num_send_frames(void) const {return _num_send_frames;} size_t get_send_frame_size(void) const {return _send_frame_size;} + uint16_t get_local_port(void) const { + struct sockaddr_in addr_info; + int addr_len = sizeof(addr_info); + uint16_t local_port = 0; + if (getsockname( _sock_fd, (SOCKADDR*) &addr_info, + &addr_len) == 0){ + local_port = ntohs(addr_info.sin_port); + } + return local_port; + } //! Read back the socket's buffer space reserved for receives size_t get_recv_buff_size(void) { |