Hello guys
This is a packet that I have to send to another application..
Code:
#define M_PKT_SIZE 1400 // max dimension of a packet
// a packet has a size and a data
typedef struct aPacket {
int pkt_length;
char data[M_PKT_SIZE];
} Packet;
This is supposed to be a buffer of packets, an array of packets:
Code:
// array of packets, it is the window
Packet window[MAX_WINDOW_SIZE];
Here I've received a packet form the local application and before sending it through the wire, I put it in the packet buffer (window)..
Code:
int r_send(const char * pkt, int pktlen) {
...
window[nextSequenceNumber % BUFFER_LENGTH]->pkt_length = buflen;
strcpy(window[nextSequenceNumber % BUFFER_LENGTH]->data, buf);[/
...
ERROR: invalid type argument of `->'
Then the same..when I have the packet in the buffer and i want to send it..
Code:
u_send (window[i % MAX_WINDOW_SIZE]->data,
window[i % MAX_WINDOW_SIZE]->pkt_length);
ERROR: invalid type argument of `->'
How can I fix this? Do I have to allocate memory before to store the packet in the packet buffer (window)? Isn't the memory allocated before because it is in an array?
Thanx