本文整理汇总了C++中ThreadInfo::GetColumnListView方法的典型用法代码示例。如果您正苦于以下问题:C++ ThreadInfo::GetColumnListView方法的具体用法?C++ ThreadInfo::GetColumnListView怎么用?C++ ThreadInfo::GetColumnListView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThreadInfo
的用法示例。
在下文中一共展示了ThreadInfo::GetColumnListView方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getShares
int32 getShares(void *data)
{
bt_request request;
bt_resource resource;
struct sockaddr_in ourAddr, toAddr, fromAddr;
char buffer[8192];
int sock, addrLen, bytes, bufPos = 0;
ThreadInfo *info = (ThreadInfo *) data;
unsigned int serverIP = ntohl(info->GetHostAddress());
memset(&toAddr, 0, sizeof(toAddr));
toAddr.sin_family = AF_INET;
toAddr.sin_port = htons(BT_QUERYHOST_PORT);
toAddr.sin_addr.s_addr = htonl(serverIP);
sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sock == INVALID_SOCKET)
return 0;
memset(&ourAddr, 0, sizeof(ourAddr));
ourAddr.sin_family = AF_INET;
ourAddr.sin_port = htons(BT_QUERYHOST_PORT);
ourAddr.sin_addr.s_addr = htonl(INADDR_ANY);
if (bind(sock, (struct sockaddr *) &ourAddr, sizeof(ourAddr)))
if (errno != EADDRINUSE)
{
closesocket(sock);
return 0;
}
strcpy(request.signature, BT_RPC_SIGNATURE);
request.command = BT_REQ_SHARE_PROBE;
sendto(sock, (char *) &request, sizeof(request), 0, (struct sockaddr *) &toAddr, sizeof(toAddr));
signal(SIGALRM, recvAlarm);
alarm(4);
addrLen = sizeof(fromAddr);
bytes = recvfrom(sock, buffer, sizeof(buffer) - 1, 0, (struct sockaddr *) &fromAddr, &addrLen);
if (bytes > 0)
if (strncmp(buffer, BT_RPC_SIGNATURE, strlen(BT_RPC_SIGNATURE)) != 0)
{
info->GetColumnListView()->LockLooper();
while (bufPos < bytes)
{
memcpy(&resource, buffer + bufPos, sizeof(bt_resource));
resource.type = B_LENDIAN_TO_HOST_INT32(resource.type);
resource.subType = B_LENDIAN_TO_HOST_INT32(resource.subType);
if (resource.type == BT_SHARED_NULL)
break;
bufPos += sizeof(bt_resource);
info->GetColumnListView()->AddItem(new ResourceItem(resource.name, resource.type));
}
info->GetColumnListView()->UnlockLooper();
}
alarm(0);
signal(SIGALRM, SIG_DFL);
closesocket(sock);
return 1;
}