J
Jack
Hi all,
I am writing an application that sends and receives large amount of
data to and from a server. I want to encode each packet similar to a
struct such that, each message has a 4 bit code (determining how it
should be parsed on the other end) as well as other info such as name,
uid, x and y positions. Here is a example of the structure:
typedef struct {
unsigned int msg:4;
unsigned int uidEmp;
char nameEmp[20];
char dataEmp[50];
}myPacket;
As you can see, my packet has various types of data types. I can
convert them all to char and then send it in a buffer form like
send(sd2,buf,strlen(buf),0);
But I think that would take way too much storage room. For instance my
msg variable of 4 bits will become a byte and same with other fields.
The reason why I am worried about the size of the packet is that,
there will be a blast of 100 packets of these types of data at once
and this may result in a major bottleneck. Is there any way to
minimize the size?
I am writing an application that sends and receives large amount of
data to and from a server. I want to encode each packet similar to a
struct such that, each message has a 4 bit code (determining how it
should be parsed on the other end) as well as other info such as name,
uid, x and y positions. Here is a example of the structure:
typedef struct {
unsigned int msg:4;
unsigned int uidEmp;
char nameEmp[20];
char dataEmp[50];
}myPacket;
As you can see, my packet has various types of data types. I can
convert them all to char and then send it in a buffer form like
send(sd2,buf,strlen(buf),0);
But I think that would take way too much storage room. For instance my
msg variable of 4 bits will become a byte and same with other fields.
The reason why I am worried about the size of the packet is that,
there will be a blast of 100 packets of these types of data at once
and this may result in a major bottleneck. Is there any way to
minimize the size?