Click here to Skip to main content
15,913,610 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Break when address reading Pin
«_Superman_»23-Sep-18 22:30
professional«_Superman_»23-Sep-18 22:30 
Questionconfusion about fonts in Windows Pin
Alexander Kindel6-Sep-18 8:43
Alexander Kindel6-Sep-18 8:43 
AnswerRe: confusion about fonts in Windows Pin
leon de boer6-Sep-18 17:12
leon de boer6-Sep-18 17:12 
GeneralRe: confusion about fonts in Windows Pin
Alexander Kindel6-Sep-18 18:21
Alexander Kindel6-Sep-18 18:21 
GeneralRe: confusion about fonts in Windows Pin
leon de boer7-Sep-18 8:41
leon de boer7-Sep-18 8:41 
GeneralRe: confusion about fonts in Windows Pin
Alexander Kindel11-Sep-18 13:24
Alexander Kindel11-Sep-18 13:24 
AnswerRe: confusion about fonts in Windows Pin
Richard Andrew x649-Sep-18 8:17
professionalRichard Andrew x649-Sep-18 8:17 
GeneralRe: confusion about fonts in Windows Pin
leon de boer9-Sep-18 18:04
leon de boer9-Sep-18 18:04 
Questionneed help with unix commands Pin
Member 139744595-Sep-18 13:24
Member 139744595-Sep-18 13:24 
AnswerRe: need help with unix commands Pin
Peter_in_27805-Sep-18 19:49
professionalPeter_in_27805-Sep-18 19:49 
AnswerRe: need help with unix commands Pin
Richard MacCutchan5-Sep-18 21:59
mveRichard MacCutchan5-Sep-18 21:59 
QuestionRe: need help with unix commands Pin
David Crow6-Sep-18 5:45
David Crow6-Sep-18 5:45 
AnswerRe: need help with unix commands Pin
jeron16-Sep-18 6:31
jeron16-Sep-18 6:31 
AnswerRe: need help with unix commands Pin
Richard MacCutchan6-Sep-18 7:04
mveRichard MacCutchan6-Sep-18 7:04 
QuestionUnable to receive custom Ethernet frame Pin
Donnie_Song1-Sep-18 16:45
Donnie_Song1-Sep-18 16:45 
SuggestionRe: Unable to receive custom Ethernet frame Pin
Richard MacCutchan1-Sep-18 21:58
mveRichard MacCutchan1-Sep-18 21:58 
GeneralRe: Unable to receive custom Ethernet frame Pin
Donnie_Song1-Sep-18 22:04
Donnie_Song1-Sep-18 22:04 
GeneralRe: Unable to receive custom Ethernet frame Pin
Richard MacCutchan1-Sep-18 22:43
mveRichard MacCutchan1-Sep-18 22:43 
GeneralRe: Unable to receive custom Ethernet frame Pin
Donnie_Song1-Sep-18 23:06
Donnie_Song1-Sep-18 23:06 
GeneralRe: Unable to receive custom Ethernet frame Pin
Victor Nijegorodov1-Sep-18 23:19
Victor Nijegorodov1-Sep-18 23:19 
GeneralRe: Unable to receive custom Ethernet frame Pin
Richard MacCutchan1-Sep-18 23:25
mveRichard MacCutchan1-Sep-18 23:25 
GeneralRe: Unable to receive custom Ethernet frame Pin
Jochen Arndt2-Sep-18 0:31
professionalJochen Arndt2-Sep-18 0:31 
GeneralRe: Unable to receive custom Ethernet frame Pin
Donnie_Song2-Sep-18 0:59
Donnie_Song2-Sep-18 0:59 
C++
int main(int argv, char *argc[])
{
        struct ifreq ifr;
        struct sockaddr_ll sll;
        int sd, sll_len;
        sll_len = sizeof(sll);
        if ((sd = socket(PF_PACKET, SOCK_RAW, htons(0x2328))) < 0)
                printf("create socket failed!\n");


        sll.sll_halen = ETH_ALEN;



        strcpy(ifr.ifr_name, "ens33");


        ioctl(sd, SIOCGIFFLAGS, &ifr);
        ifr.ifr_flags |= IFF_PROMISC;

        if(fcntl(sd, F_SETFL, O_NONBLOCK) == -1) {
                perror("fcntl");
                exit(errno);
        }
        char recvbuf[2048];
        sleep(5);
        int n_read = recvfrom(sd, recvbuf, 2048, 0, (struct sockaddr *)&sll, &sll_len);
        if (n_read <= 0)
        {
                printf("%d\n", errno);
        }
}


I started to cycle data before I hibernate, but I still can't receive it
GeneralRe: Unable to receive custom Ethernet frame Pin
Donnie_Song2-Sep-18 3:32
Donnie_Song2-Sep-18 3:32 
GeneralRe: Unable to receive custom Ethernet frame Pin
Jochen Arndt2-Sep-18 7:58
professionalJochen Arndt2-Sep-18 7: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.