Click here to Skip to main content
13,765,990 members

C / C++ / MFC

 
AnswerRe: need help with unix commands Pin
Richard MacCutchan5-Sep-18 22:59
protectorRichard MacCutchan5-Sep-18 22:59 
QuestionRe: need help with unix commands Pin
David Crow6-Sep-18 6:45
memberDavid Crow6-Sep-18 6:45 
AnswerRe: need help with unix commands Pin
jeron16-Sep-18 7:31
memberjeron16-Sep-18 7:31 
AnswerRe: need help with unix commands Pin
Richard MacCutchan6-Sep-18 8:04
protectorRichard MacCutchan6-Sep-18 8:04 
QuestionMessage Closed Pin
5-Sep-18 13:23
memberMember 139744335-Sep-18 13:23 
GeneralMessage Closed Pin
4-Sep-18 2:15
memberMember 139723974-Sep-18 2:15 
GeneralMessage Closed Pin
4-Sep-18 2:15
memberMember 139723974-Sep-18 2:15 
QuestionUnable to receive custom Ethernet frame Pin
Donnie_Song1-Sep-18 17:45
memberDonnie_Song1-Sep-18 17:45 
I created a socket_raw, the custom protocol type is 0x2328, and I send 0x2328 type data on another machine. The capture packet can be captured, but recvfrom cannot receive it. What should I do? Here is the code received.

struct sockaddr_ll sll;
struct ifreq ifr;

if ((sd = socket (PF_PACKET, SOCK_RAW, htons (0x2328))) < 0) {
    perror ("socket() failed to get socket descriptor for using ioctl() ");
    exit (EXIT_FAILURE);
}

// Use ioctl() to look up interface name and get its MAC address.
memset (&ifr, 0, sizeof (ifr));
sprintf (ifr.ifr_name, "eth1");

if (ioctl (sd, SIOCGIFINDEX, &ifr) < 0) {
    perror ("ioctl() failed");
    return (EXIT_FAILURE);
}

memset (&sll, 0, sizeof (sll));
int sll_len;
sll.sll_family  = AF_PACKET;
sll.sll_ifindex = ifr.ifr_ifindex;
sll_len         = sizeof(sll);

char buffer[1024];
recvfrom(sd, buffer, sizeof(buffer), 0, (struct sockaddr *)&sll, &sll_len);

SuggestionRe: Unable to receive custom Ethernet frame Pin
Richard MacCutchan1-Sep-18 22:58
protectorRichard 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
protectorRichard 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
protectorRichard MacCutchan2-Sep-18 0:25 
GeneralRe: Unable to receive custom Ethernet frame Pin
Jochen Arndt2-Sep-18 1:31
mvpJochen 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 
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
mvpJochen Arndt2-Sep-18 8:58 
GeneralMessage Closed Pin
5-Sep-18 20:43
memberfarman abdullah5-Sep-18 20:43 
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
protectorRichard MacCutchan29-Aug-18 6:51 
AnswerRe: Invalid operands Pin
CPallini29-Aug-18 21:53
mvpCPallini29-Aug-18 21:53 

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.


Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.181114.1 | Last Updated 15 Nov 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid