Skip to content

Commit

Permalink
Merge pull request #10 from n1gp/protocol2
Browse files Browse the repository at this point in the history
Send a separate Discovery packet for P2 to match protocol specification
  • Loading branch information
k3it authored Jan 14, 2023
2 parents 0f1d867 + 92b35eb commit 27a7acc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions HermesIntf/Hermes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,12 @@ namespace HermesIntf
char recvbuff[1500] = {0};
int recvbufflen = 1500;
char sendMSG[63] = {0};
char sendMSG_P2[60] = {0};
sendMSG[0] = (char) 0xEF;
sendMSG[1] = (char) 0xFE;
sendMSG[2] = (char) 0x02;

sendMSG[4] = (char) 0x02;
sendMSG_P2[4] = (char) 0x02;

//send out broadcast from each interface

Expand Down Expand Up @@ -370,9 +371,11 @@ namespace HermesIntf
//calculate magic broadcast address
bcast_addr.sin_addr.S_un.S_addr = pAddress->sin_addr.S_un.S_addr | (~ pMask->sin_addr.S_un.S_addr);

//send discovery
//send discovery P1
sendto(sock,sendMSG,sizeof(sendMSG),0,(sockaddr *)&bcast_addr,sizeof(bcast_addr));

//send discovery P2
sendto(sock, sendMSG_P2, sizeof(sendMSG_P2), 0, (sockaddr*)& bcast_addr, sizeof(bcast_addr));
}


Expand Down

0 comments on commit 27a7acc

Please sign in to comment.