I am having an already existing code(cuda c++) which I want to debug and this uses sockets in c++, I am quite not sure what exactly it's trying to do and how will be able to link to a particular address? Please help me with understanding what are ai_family
,ai_socktype
,ai_protocol
and other means?
int sockfd = socket(host_info->ai_family, host_info->ai_socktype, host_info->ai_protocol);
if (sockfd<0)
{
printf("can't create socket\n");
return false;
}
if (connect(sockfd, host_info->ai_addr, host_info->ai_addrlen)<0)
{
printf("can't create connection\n");
return false;
}