10-26-05 11:01 PM
i'm trying to set up a secure client-server connection (for now without
encryption) and want to verify if the x+1'th message received is from
the same sender as the x'th message
i've tried to print the MAC address via the ioctl, both it complains
that the protocol family isn't supported
/* ****************************************
*************** */
//...
recv_sd = accept(listen_sd, (struct sockaddr*) &client, &len);
struct arpreq arpreq_;
bzero(&arpreq_, sizeof(struct arpreq));
if( ( n = ioctl(recv_sd, SIOCGARP, &arpreq_) ) < 0 ){
sendErrorMessage("ioctl error", __FUNCTION__, TCL_ERROR, 1);
}
unsigned char *ptr = &arpreq_.arp_ha.sa_data[0];
printf("MAC: %x:%x:%x:%x:%x:%x\n", *ptr, *(ptr+1), *(ptr+2), *(ptr+3),
*(ptr+4), *(ptr+5));
//...
/* ****************************************
*************** */
the client's protocol family is AF_INET and ioctl needs AF_UNRES
is there maybe a way to "convert" a socket's family?
[ Post a follow-up to this message ]
|