Add new xml tag to flrig for identifying the client...will help debugging.

pull/750/head
Mike Black W9MDB 2021-07-21 22:59:53 -05:00
rodzic a8200886bf
commit 7d5fa7dc88
2 zmienionych plików z 7 dodań i 0 usunięć

Wyświetl plik

@ -2179,6 +2179,7 @@ typedef struct hamlib_port {
int value; /*!< Toggle PTT ON or OFF */ int value; /*!< Toggle PTT ON or OFF */
} gpio; /*!< GPIO attributes */ } gpio; /*!< GPIO attributes */
} parm; /*!< Port parameter union */ } parm; /*!< Port parameter union */
int client_port; /*!< client socket port for tcp connection */
} hamlib_port_t; } hamlib_port_t;
//! @endcond //! @endcond

Wyświetl plik

@ -165,6 +165,7 @@ int network_open(hamlib_port_t *rp, int default_port)
int status; int status;
struct addrinfo hints, *res, *saved_res; struct addrinfo hints, *res, *saved_res;
struct in6_addr serveraddr; struct in6_addr serveraddr;
struct sockaddr_in client;
char hoststr[256], portstr[6] = ""; char hoststr[256], portstr[6] = "";
ENTERFUNC; ENTERFUNC;
@ -299,6 +300,11 @@ int network_open(hamlib_port_t *rp, int default_port)
rp->fd = fd; rp->fd = fd;
socklen_t clientLen = sizeof(client);
getsockname(rp->fd, (struct sockaddr *)&client, &clientLen);
rig_debug(RIG_DEBUG_ERR, "%s: client port=%d\n", __func__, client.sin_port);
rp->client_port = client.sin_port;
RETURNFUNC(RIG_OK); RETURNFUNC(RIG_OK);
} }