Displaying 1 result from an estimated 1 matches for "vnc_addr".
Did you mean:
mic_addr
2009 Jun 08
2
[PATCH] few minor bugfixes
...defined(HAVE_SOCKET) && defined(HAVE_CONNECT) && defined(HAVE_HTONS)
static int
viewer_open_vnc_socket(const char* vnchost, int vncport)
{
- int socketfd;
- struct hostent *serv;
- struct sockaddr_in serv_addr;
+ int result, socketfd;
+ char port[10];
+ struct addrinfo* vnc_addr;
- socketfd = socket(PF_INET, SOCK_STREAM, 0);
- if(socketfd < 0){
- return -1;
- }
+ sprintf(port, "%d", vncport);
- serv = gethostbyname(vnchost);
- if(serv == NULL){
+ result = getaddrinfo(vnchost, port, NULL, &vnc_addr);
+ if(result != 0 || vnc_addr == NULL)...