|
* otherwise Size of packet received.
*/
int
ReadFromNetwork(int sock, char *device, char *data, int len)
{
struct sockaddr sa;
int sz = sizeof(sa);
int error;
error = recvfrom(sock, data, len, 0, &sa, &sz);
if (error == -1)
return -1;
strcpy(device, sa.sa_data);
return error; /* Actually size of received packet */
}
/*
* Handy support routines.
*/
/*
* Obtain the hardware address of an interface.
* addr should be a buf 页码:[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] 第7页、共11页 |