Click here to Skip to main content
15,867,141 members
Home / Discussions / Windows Development
   

Windows Development

 
QuestionHow is the Windows 10 Device Manager "Display Adapters" icon supposed to look? Pin
RedDk16-May-20 12:31
RedDk16-May-20 12:31 
AnswerRe: How is the Windows 10 Device Manager "Display Adapters" icon supposed to look? Pin
Dave Kreskowiak20-May-20 8:57
mveDave Kreskowiak20-May-20 8:57 
GeneralRe: How is the Windows 10 Device Manager "Display Adapters" icon supposed to look? Pin
RedDk20-May-20 9:37
RedDk20-May-20 9:37 
QuestionPreviewing files within an application Pin
kalberts28-Apr-20 22:15
kalberts28-Apr-20 22:15 
SuggestionRe: Previewing files within an application Pin
Richard MacCutchan28-Apr-20 22:51
mveRichard MacCutchan28-Apr-20 22:51 
AnswerRe: Previewing files within an application Pin
JudyL_MD30-Apr-20 7:05
JudyL_MD30-Apr-20 7:05 
QuestionSendInput mouse/keyboard and TouchScreen Pin
Member 142257573-Mar-20 4:34
Member 142257573-Mar-20 4:34 
AnswerRe: SendInput mouse/keyboard and TouchScreen Pin
Randor 15-Aug-20 9:06
professional Randor 15-Aug-20 9:06 
QuestionDNS query with winsock was failed Pin
Eugene Pustovoyt12-Feb-20 4:35
Eugene Pustovoyt12-Feb-20 4:35 
Hi, everybody
I understand winsock has gethostbyname for this. But I need to debug for embedded application and first I try the code on Windows. Here is a my code:
C++
sockaddr_in dns_addr;
int dns_size = sizeof(dns_addr);
ZeroMemory(&dns_addr, dns_size);
dns_addr.sin_family = AF_INET;
dns_addr.sin_port = htons(53);
dns_addr.sin_addr.s_addr = inet_addr("8.8.8.8");

SOCKET out = socket(AF_INET, SOCK_DGRAM, 0);

char msg[] = {
    0x12, 0x34,         // ID
    0x01, 0x00,         // QR ... RCODE
    0x00, 0x01,         // QDCOUNT
    0x00, 0x00,         // ANCOUNT
    0x00, 0x00,         // NSCOUNT
    0x00, 0x00,         // ARCOUNT
    0x03,
    0x77, 0x77, 0x77,       // www
    0x03,
    0x74, 0x75, 0x74,       // tut
    0x02,
    0x62, 0x79,         // by
    0x00,
    0x00, 0x01,         // TYPE_A
    0x00, 0x01          // CLASS_IN
};
int msg_size = sizeof(msg);
int iSendOk = sendto(out, msg, msg_size, 0, (sockaddr*)&dns_addr, dns_size);

if (iSendOk != SOCKET_ERROR)
{
    char bufstr[100];
    sockaddr_in dest_addr;
    int dest_addr_size = sizeof(dest_addr);
    int iReceived = recvfrom(out, bufstr, 100, 0,(sockaddr*)&dest_addr, &dest_addr_size);
}

closesocket(out);


And this code freezes when recvfrom function is execution. The function is executed with an infinite loop and never returns. What do I do wrong?
Eugene Pustovoyt
Soft and Hard Developer

CPPMessageBox v1.0
CPPToolTip v2.1
CPPDumpCtrl v1.2
CPPHtmlStatic v1.2

AnswerRe: DNS query with winsock was failed Pin
Gerry Schmitz12-Feb-20 10:06
mveGerry Schmitz12-Feb-20 10:06 
GeneralRe: DNS query with winsock was failed Pin
Eugene Pustovoyt12-Feb-20 21:48
Eugene Pustovoyt12-Feb-20 21:48 
AnswerRe: DNS query with winsock was failed Pin
Richard MacCutchan12-Feb-20 21:58
mveRichard MacCutchan12-Feb-20 21:58 
GeneralRe: DNS query with winsock was failed Pin
Eugene Pustovoyt12-Feb-20 22:04
Eugene Pustovoyt12-Feb-20 22:04 
GeneralRe: DNS query with winsock was failed Pin
Richard MacCutchan12-Feb-20 23:27
mveRichard MacCutchan12-Feb-20 23:27 
GeneralRe: DNS query with winsock was failed Pin
Eugene Pustovoyt12-Feb-20 23:35
Eugene Pustovoyt12-Feb-20 23:35 
GeneralRe: DNS query with winsock was failed Pin
Richard MacCutchan12-Feb-20 23:49
mveRichard MacCutchan12-Feb-20 23:49 
AnswerRe: DNS query with winsock was failed Pin
Randor 15-Aug-20 9:19
professional Randor 15-Aug-20 9:19 
QuestionObtaining HINTERNET Handles Pin
ForNow11-Feb-20 3:15
ForNow11-Feb-20 3:15 
AnswerRe: Obtaining HINTERNET Handles Pin
Richard MacCutchan11-Feb-20 5:26
mveRichard MacCutchan11-Feb-20 5:26 
GeneralRe: Obtaining HINTERNET Handles Pin
ForNow11-Feb-20 5:53
ForNow11-Feb-20 5:53 
GeneralRe: Obtaining HINTERNET Handles Pin
Richard MacCutchan11-Feb-20 8:18
mveRichard MacCutchan11-Feb-20 8:18 
GeneralRe: Obtaining HINTERNET Handles Pin
ForNow11-Feb-20 9:11
ForNow11-Feb-20 9:11 
GeneralRe: Obtaining HINTERNET Handles Pin
Richard MacCutchan11-Feb-20 9:37
mveRichard MacCutchan11-Feb-20 9:37 
GeneralRe: Obtaining HINTERNET Handles Pin
ForNow11-Feb-20 10:26
ForNow11-Feb-20 10:26 
QuestionRegistery Setting for FTP Pin
ForNow9-Feb-20 5:58
ForNow9-Feb-20 5:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.