The structure that you are trying to send.. is that something you made? Is the receiving end a program that you're writing? If not, what format does it expect the data to be in? Serialization/Deserialization is a process. That's all. There is nothing magic involved. You can always write your own functions to serialize and deserialize data. Here's an example of a simple structure that is serialized into a byte array:
struct myStruct
{
int iValue; // integer value
string strValue; // zero terminated string
public myStruct(byte\[\] sourceArray)
{
int k;
if(sourceArray.Length > 2)
{
// reconstruct int value from lo byte and hi byte
this.iValue = sourceArray\[0\] + sourceArray\[1\] \* 256;
// reconstruct string value
this.strValue = "";
k = 2;
while(sourceArray\[k\]!=0 && k\> 8) & 0xFF; // hi byte
// save the string value
k = 0;
while(k < this.strValue.Length)
tmpArray\[k + 2\] = this.strValue.ToCharArray()\[k++\];
return tmpArray;
}
}
// ...
// test code
byte[] t;
myStruct A;
myStruct B;
A = new myStruct();
A.iValue = 567;
A.strValue = "test string";
t = A.Serialize(); // t = serialized array of the strucutre
B = new myStruct(t); // B = a copy of A, constructed by deserializing t
obviously, once you serialize your structure into an array you can send it over TCP/IP using a WinSock ---- www.digitalGetto.com