Tuesday, 15 September 2015

c - sending variable of type struct into socket -



c - sending variable of type struct into socket -

for study project, can send variable of type struct server client had info of employee(id,salary etc), not much used of c not much clear concept. or give me thought in form can send info on socket.

while struct contents can transmitted, cause problems.

struct alignment varies between compilers, target cpus, , version of cpu. also, size of each construction element requires care consistent size across architectures.

struct s { int a; short b; long c; long double d; };

while engineers aware int anywhere 16 128 bits, depending on target architecture, other fields might have sizes different target target. long double might equivalent float on primitive embedded cpus and 64, 80, or 128 bits on mainstream architectures.

to resolve these problems, total spectrum of solutions have evolved: total command of both ends of communication link converting info streaming format xml.

c sockets udp

No comments:

Post a Comment