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);