struct sockaddr_in clientaddr1; memset(&clientaddr1, 0x00, sizeof(clientaddr1)); socklen_t nl=sizeof(clientaddr1); getpeername(SM_sd,(struct sockaddr*)&clientaddr1,&nl); string addr=inet_ntoa(clientaddr1.sin_addr);
struct sockaddr_in clientaddr1; memset(&clientaddr1, 0x00, sizeof(clientaddr1)); socklen_t nl=sizeof(clientaddr1); getpeername(SM_sd,(struct sockaddr*)&clientaddr1,&nl); string addr=inet_ntoa(clientaddr1.sin_addr);
转载于:https://www.cnblogs.com/LeoGodfrey/p/3316126.html