| |
| | |
| Do you have any C++ sample code to illustrate how to send binary data? |
|
| | |
| Product: Distinct VIT | Topic: Windows Sockets | Last updated: 3/28/2008 | | | | Q.: Do you have any C++ sample code to illustrate how to send binary data? | A.: Here it is:
//
// BEGIN SENDB.CPP
// This code segment ilustrates how to
// SEND binary data (structure) using
// the SendB Method.
//
{
struct tmp {
char command, phyline;
short projnum;
char uid[20];
} sud;
sud.command = 1;
sud.phyline = 0;
sud.projnum = 0;
strcpy (sud.uid, "supervisor");
long bytes = sizeof(sud);
VARIANT x;
x.parray = (SAFEARRAY *) calloc (1, sizeof (SAFEARRAY));
x.parray->pvData = &sud;
m_socket.SendB(x, bytes);
free (x.parray);
}
//
// END SENDB.CPP
//
|
If you did not find what you are looking for:
|
![]()
|
|