Click here to Skip to main content
15,570,042 members
Home / Discussions / Windows Development
   

Windows Development

 
AnswerRe: How is the Windows 10 Device Manager "Display Adapters" icon supposed to look? Pin
Dave Kreskowiak20-May-20 9:57
mveDave Kreskowiak20-May-20 9:57 
GeneralRe: How is the Windows 10 Device Manager "Display Adapters" icon supposed to look? Pin
RedDk20-May-20 10:37
RedDk20-May-20 10:37 
QuestionPreviewing files within an application Pin
kalberts28-Apr-20 23:15
kalberts28-Apr-20 23:15 
SuggestionRe: Previewing files within an application Pin
Richard MacCutchan28-Apr-20 23:51
mveRichard MacCutchan28-Apr-20 23:51 
AnswerRe: Previewing files within an application Pin
JudyL_MD30-Apr-20 8:05
JudyL_MD30-Apr-20 8:05 
QuestionSendInput mouse/keyboard and TouchScreen Pin
Member 142257573-Mar-20 5:34
Member 142257573-Mar-20 5:34 
AnswerRe: SendInput mouse/keyboard and TouchScreen Pin
Randor 15-Aug-20 10:06
professional Randor 15-Aug-20 10:06 
QuestionDNS query with winsock was failed Pin
Eugene Pustovoyt12-Feb-20 5:35
Eugene Pustovoyt12-Feb-20 5: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 11:06
mveGerry Schmitz12-Feb-20 11:06 
GeneralRe: DNS query with winsock was failed Pin
Eugene Pustovoyt12-Feb-20 22:48
Eugene Pustovoyt12-Feb-20 22:48 
AnswerRe: DNS query with winsock was failed Pin
Richard MacCutchan12-Feb-20 22:58
mveRichard MacCutchan12-Feb-20 22:58 
GeneralRe: DNS query with winsock was failed Pin
Eugene Pustovoyt12-Feb-20 23:04
Eugene Pustovoyt12-Feb-20 23:04 
GeneralRe: DNS query with winsock was failed Pin
Richard MacCutchan13-Feb-20 0:27
mveRichard MacCutchan13-Feb-20 0:27 
GeneralRe: DNS query with winsock was failed Pin
Eugene Pustovoyt13-Feb-20 0:35
Eugene Pustovoyt13-Feb-20 0:35 
GeneralRe: DNS query with winsock was failed Pin
Richard MacCutchan13-Feb-20 0:49
mveRichard MacCutchan13-Feb-20 0:49 
AnswerRe: DNS query with winsock was failed Pin
Randor 15-Aug-20 10:19
professional Randor 15-Aug-20 10:19 
QuestionObtaining HINTERNET Handles Pin
ForNow11-Feb-20 4:15
ForNow11-Feb-20 4:15 
AnswerRe: Obtaining HINTERNET Handles Pin
Richard MacCutchan11-Feb-20 6:26
mveRichard MacCutchan11-Feb-20 6:26 
GeneralRe: Obtaining HINTERNET Handles Pin
ForNow11-Feb-20 6:53
ForNow11-Feb-20 6:53 
GeneralRe: Obtaining HINTERNET Handles Pin
Richard MacCutchan11-Feb-20 9:18
mveRichard MacCutchan11-Feb-20 9:18 
GeneralRe: Obtaining HINTERNET Handles Pin
ForNow11-Feb-20 10:11
ForNow11-Feb-20 10:11 
GeneralRe: Obtaining HINTERNET Handles Pin
Richard MacCutchan11-Feb-20 10:37
mveRichard MacCutchan11-Feb-20 10:37 
GeneralRe: Obtaining HINTERNET Handles Pin
ForNow11-Feb-20 11:26
ForNow11-Feb-20 11:26 
QuestionRegistery Setting for FTP Pin
ForNow9-Feb-20 6:58
ForNow9-Feb-20 6:58 
AnswerRe: Registery Setting for FTP Pin
Richard MacCutchan9-Feb-20 7:57
mveRichard MacCutchan9-Feb-20 7:57 

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.