Obtaining local IP address using getaddrinfo() C function?

前端 未结 2 498
故里飘歌
故里飘歌 2020-12-08 08:29

I\'m trying to obtain my local (not the external) IP address using the getaddrinfo() function, but I saw the examples provided here, and they where too complex for my needs.

2条回答
  •  囚心锁ツ
    2020-12-08 09:21

    Pass the hostname after using gethostname(), to gethostbyname()

    int gethostname(char *hostname, size_t size);
    

提交回复
热议问题