Trying to program a stop and wait network protocol in C which will send a packet in the form of a struct
I have been reading up on the send() and recv() classes but still don't have enough knowledge to know how to send a "packet" over. Can someone clarify how to do this with me?
unsigned char seq; //sequence number
unsigned char wndwsize; //size of the send window
unsigned char pcktsize; //packet size
data char[sizeof pcktsize]; //data array size of packetsize (-overhead)
Here's what I have been playing with
Can I just send with the given socket and the packet? Also how would I receive it?
struct MyHdr packet;
packet.pcktsize = buffer;//copy buffer into our packet 64bytes
packet.seq = count;
packet.wndwsize = count;
//something with a CRC