| | 264 | |
|---|
| | 265 | /* |
|---|
| | 266 | string command(msg->getMsg(),msg->getSize()); |
|---|
| | 267 | |
|---|
| | 268 | unsigned int offset; |
|---|
| | 269 | if (((offset = command.find("list"))) < command.size() ) |
|---|
| | 270 | { |
|---|
| | 271 | int fd; |
|---|
| | 272 | |
|---|
| | 273 | for (fd=0;fd<64*1024;fd++) |
|---|
| | 274 | { |
|---|
| | 275 | int32_t iError = 0; |
|---|
| | 276 | int32_t iSize = sizeof(iError); |
|---|
| | 277 | |
|---|
| | 278 | |
|---|
| | 279 | if (getsockopt(fd,SOL_SOCKET, SO_ERROR, &iError,(socklen_t *) &iSize) == 0 ) |
|---|
| | 280 | { |
|---|
| | 281 | if (iError != 0) |
|---|
| | 282 | continue; |
|---|
| | 283 | |
|---|
| | 284 | struct sockaddr_in addrLocal; |
|---|
| | 285 | iSize = sizeof(addrLocal); |
|---|
| | 286 | |
|---|
| | 287 | if ( getsockname(fd, (struct sockaddr *) &addrLocal, (socklen_t *) &iSize) != 0 ) |
|---|
| | 288 | continue; |
|---|
| | 289 | |
|---|
| | 290 | struct sockaddr_in addrRemote; |
|---|
| | 291 | iSize = sizeof(addrRemote); |
|---|
| | 292 | if ( getpeername(fd, (struct sockaddr *) &addrRemote, (socklen_t *) &iSize) != 0 ) |
|---|
| | 293 | continue; |
|---|
| | 294 | |
|---|
| | 295 | |
|---|
| | 296 | string localhost,remotehost; |
|---|
| | 297 | |
|---|
| | 298 | localhost = inet_ntoa(*(struct in_addr *)&((sockaddr_in)addrLocal).sin_addr); |
|---|
| | 299 | remotehost = inet_ntoa(*(struct in_addr *)&((sockaddr_in)addrRemote).sin_addr); |
|---|
| | 300 | |
|---|
| | 301 | logInfo("%i %-15s -> %-15s\n",fd,localhost.c_str(),remotehost.c_str()); |
|---|
| | 302 | |
|---|
| | 303 | close(fd); |
|---|
| | 304 | } |
|---|
| | 305 | } |
|---|
| | 306 | } |
|---|
| | 307 | |
|---|
| | 308 | return CL_ASSIGN; |
|---|
| | 309 | */ |
|---|