I have a TCP client and server and I want to implement a security layer using GnuTLS. I have read in the GnuTLS documentation and they don't speak about connect to a specific ip address nor port. They do set an ip address in an certtool template that can be used to generate a certificate request.
But in my case, as a client, I get the server address during a UDP session, and then I connect my TCP socket to it.
In the example given in the documentation there is this line :
(session, GNUTLS_NAME_DNS, "my_host_name", strlen("my_host_name"));
...which I believe is responsible to get the server address.