Click here to Skip to main content
15,169,508 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
SuggestionRe: Unable to receive custom Ethernet frame Pin
Richard MacCutchan1-Sep-18 22:58
mveRichard MacCutchan1-Sep-18 22:58 
GeneralRe: Unable to receive custom Ethernet frame Pin
Donnie_Song1-Sep-18 23:04
MemberDonnie_Song1-Sep-18 23:04 
GeneralRe: Unable to receive custom Ethernet frame Pin
Richard MacCutchan1-Sep-18 23:43
mveRichard MacCutchan1-Sep-18 23:43 
GeneralRe: Unable to receive custom Ethernet frame Pin
Donnie_Song2-Sep-18 0:06
MemberDonnie_Song2-Sep-18 0:06 
GeneralRe: Unable to receive custom Ethernet frame Pin
Victor Nijegorodov2-Sep-18 0:19
MemberVictor Nijegorodov2-Sep-18 0:19 
GeneralRe: Unable to receive custom Ethernet frame Pin
Richard MacCutchan2-Sep-18 0:25
mveRichard MacCutchan2-Sep-18 0:25 
GeneralRe: Unable to receive custom Ethernet frame Pin
Jochen Arndt2-Sep-18 1:31
professionalJochen Arndt2-Sep-18 1:31 
GeneralRe: Unable to receive custom Ethernet frame Pin
Donnie_Song2-Sep-18 1:59
MemberDonnie_Song2-Sep-18 1: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 4:32
MemberDonnie_Song2-Sep-18 4:32 
GeneralRe: Unable to receive custom Ethernet frame Pin
Jochen Arndt2-Sep-18 8:58
professionalJochen Arndt2-Sep-18 8:58 
QuestionInvalid operands Pin
meerokh29-Aug-18 5:30
Membermeerokh29-Aug-18 5:30 
AnswerRe: Invalid operands Pin
Victor Nijegorodov29-Aug-18 5:39
MemberVictor Nijegorodov29-Aug-18 5:39 
GeneralRe: Invalid operands Pin
meerokh29-Aug-18 5:49
Membermeerokh29-Aug-18 5:49 
QuestionRe: Invalid operands Pin
David Crow29-Aug-18 10:34
MemberDavid Crow29-Aug-18 10:34 
AnswerRe: Invalid operands Pin
Richard MacCutchan29-Aug-18 6:51
mveRichard MacCutchan29-Aug-18 6:51 
AnswerRe: Invalid operands Pin
CPallini29-Aug-18 21:53
mveCPallini29-Aug-18 21:53 
QuestionRearrange array in alternating positive & negative items with O(1) extra space, while keeping the order of the elements maintained. Pin
Tarun Jha28-Aug-18 19:33
MemberTarun Jha28-Aug-18 19:33 
AnswerRe: Rearrange array in alternating positive & negative items with O(1) extra space, while keeping the order of the elements maintained. Pin
CPallini28-Aug-18 22:52
mveCPallini28-Aug-18 22:52 
QuestionHow I can make the GUI like as photoshop (dark theme) by using Visual Studio C++ ? Pin
sasia22521-Aug-18 18:38
Membersasia22521-Aug-18 18:38 
AnswerRe: How I can make the GUI like as photoshop (dark theme) by using Visual Studio C++ ? Pin
Richard MacCutchan21-Aug-18 22:19
mveRichard MacCutchan21-Aug-18 22:19 
GeneralRe: How I can make the GUI like as photoshop (dark theme) by using Visual Studio C++ ? Pin
sasia22521-Aug-18 22:28
Membersasia22521-Aug-18 22:28 
GeneralRe: How I can make the GUI like as photoshop (dark theme) by using Visual Studio C++ ? Pin
Richard MacCutchan21-Aug-18 23:38
mveRichard MacCutchan21-Aug-18 23:38 
GeneralRe: How I can make the GUI like as photoshop (dark theme) by using Visual Studio C++ ? Pin
sasia22521-Aug-18 23:44
Membersasia22521-Aug-18 23:44 
AnswerRe: How I can make the GUI like as photoshop (dark theme) by using Visual Studio C++ ? Pin
Jochen Arndt21-Aug-18 23:40
professionalJochen Arndt21-Aug-18 23:40 
GeneralRe: How I can make the GUI like as photoshop (dark theme) by using Visual Studio C++ ? Pin
sasia22521-Aug-18 23:43
Membersasia22521-Aug-18 23:43 

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.