Click to See Complete Forum and Search --> : Sending text and int


sezar355
August 23rd, 2009, 12:01 PM
Hi All...

Im new about programming and Ive read Beej network programming guide to learn about. Beej tells how to send text and integer data but But what if I have to send them in a packet ??

jeroendeleeuw
August 30th, 2009, 04:45 AM
You could use a structure to store the data in, if that is what you mean? You have to define the same structure on the other side to be able to read it.

sezar355
September 1st, 2009, 06:29 AM
yea but how can I send a struct like that?

struct info {
char type[1];
uint32_t ipno;
char checking[14];
}tt;

hoxsiew
September 1st, 2009, 09:58 AM
send(sock,(char *)&tt,sizeof(tt),0);

sezar355
September 3rd, 2009, 03:16 PM
and if you can write how to read from the reciever side, I will be so glad :)

thanks for reply