|
-
October 28th, 1999, 12:52 PM
#1
Socket question, can someone please help me ????
Hi,
If variable 'b' is a type of struct, say
struct data {
char packet[32];
int alert;
};
....
data *b;
what function from the winsock library can I use to send b to a remote client or server ??? CAN SOMEONE PLEASE HELP ME ??
-
October 29th, 1999, 01:46 AM
#2
Re: Socket question, can someone please help me ????
1) memcpy that struct into a char buffer:
char *buf = (char *)malloc(sizeof(data));
memcpy(buf, &b, sizeof(data);
send(socket, buf, sizeof(data), 0);
or
2) typecast to char *
send(socket, (char *)&b, sizeof(data), 0);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|