2019-05-12 06:38 PM
I'm writing a program using socket API. when a client Socket connected to my server Socket ,I tried to get its IP address but the result returned 0.0.0.0.
int ConnectFD = accept(socketFD, (struct sockaddr *)&remotehost, (socklen_t *)&sockaddrsize);
if( ConnectFD != -1)
{
struct sockaddr_in *ad;
socklen_t len;
ad = (struct sockaddr_in*)&remotehost; printf("client%sconnected,ID:%d\n",ip4addr_ntoa((structip4_addr*)&ad>sin_addr),ConnectFD);
2019-05-13 06:26 PM
up
2019-05-13 09:40 PM
up