Code:
cli_reliable.c: In function `rel_receive_packet':
cli_reliable.c:46: error: request for member `header' in something not a structure or union
When compiling with the latest gcc. Here is the relative code:
Code:
#define PACKET_SIZE 64
#define HEADER_SIZE sizeof(HEADER)
#define MAX_DATA PACKET_SIZE-HEADER_SIZE
typedef struct
{
char is_data; // 1 if this is a data packet, 0 for an ack
int fragment; // fragment number (zero indexed)
char last; // 1 if this is the last packet in the message, 0 otherwise
int datalen; // length of data in bytes - only used for last packet
} HEADER;
typedef struct
{
HEADER header; // the packet header (described above)
char data[MAX_DATA]; // the contents of the packet
} PACKET;
int rel_receive_packet(int socket, PACKET *packet, int required_frag, int verbose, int reliable)
{
//if reliable transmission is turned off, just get the next packet
int result = socket_receive_packet(socket, packet, reliable);
if ( packet.header.fragment != required_frag )
{
........................
return result;
}
Am I missing something?