Click here to Skip to main content
14,606,278 members

Managed C++/CLI

QuestionTemplates in managed c++ Pin
aloktambi3-Jul-06 1:46
Memberaloktambi3-Jul-06 1:46 
AnswerRe: Templates in managed c++ Pin
_AnsHUMAN_ 4-Jul-06 3:43
Member_AnsHUMAN_ 4-Jul-06 3:43 
QuestionTemplates and multiple inheritance in manged c++ Pin
aloktambi2-Jul-06 21:18
Memberaloktambi2-Jul-06 21:18 
QuestionHow to send a message in TCP/IP? Pin
pShay2-Jul-06 4:04
MemberpShay2-Jul-06 4:04 
AnswerRe: How to send a message in TCP/IP? Pin
mikanu2-Jul-06 5:38
Membermikanu2-Jul-06 5:38 
GeneralRe: How to send a message in TCP/IP? Pin
pShay2-Jul-06 7:08
MemberpShay2-Jul-06 7:08 
GeneralRe: How to send a message in TCP/IP? Pin
Michael Dunn2-Jul-06 8:55
sitebuilderMichael Dunn2-Jul-06 8:55 
GeneralRe: How to send a message in TCP/IP? [modified] Pin
mikanu2-Jul-06 10:29
Membermikanu2-Jul-06 10:29 
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<sourceArray.Length)
                this.strValue += (char)sourceArray[k++];

    public byte[] Serialize()
        int k;
        byte[] tmpArray = new byte[2 + this.strValue.Length];

        // save the int value as the first two bytes 
        tmpArray[0] = this.iValue & 0xFF;  // lo byte
        tmpArray[1] = (this.iValue >> 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

GeneralRe: How to send a message in TCP/IP? Pin
pShay2-Jul-06 20:22
MemberpShay2-Jul-06 20:22 
GeneralRe: How to send a message in TCP/IP? Pin
Jun Du5-Jul-06 4:12
MemberJun Du5-Jul-06 4:12 
GeneralRe: How to send a message in TCP/IP? Pin
pShay5-Jul-06 20:30
MemberpShay5-Jul-06 20:30 
Questionusing Templates and multiple inheritance in managed Pin
ajay kr. boosar1-Jul-06 4:48
Memberajay kr. boosar1-Jul-06 4:48 
QuestionFrames and Auto Navigation with WebBrowser2 Pin
Dave_Roach1-Jul-06 4:38
MemberDave_Roach1-Jul-06 4:38 
Questionbool isPrime (int Number) Pin
jon-801-Jul-06 0:41
professionaljon-801-Jul-06 0:41 
QuestionWhere to start? Pin
Stober30-Jun-06 11:42
MemberStober30-Jun-06 11:42 
AnswerRe: Where to start? Pin
Michael Dunn30-Jun-06 23:07
sitebuilderMichael Dunn30-Jun-06 23:07 
Questionabout powerpoint reader Pin
xiahuang11929-Jun-06 17:49
Memberxiahuang11929-Jun-06 17:49 
QuestionEnhance pointer precision Pin
coolice200229-Jun-06 8:27
Membercoolice200229-Jun-06 8:27 
QuestionRe: Enhance pointer precision Pin
Jun Du29-Jun-06 9:11
MemberJun Du29-Jun-06 9:11 
QuestionRe: Enhance pointer precision [modified] Pin
coolice200229-Jun-06 20:49
Membercoolice200229-Jun-06 20:49 
Questionhow do i use OpenCV code in windows forums [modified] Pin
zamco28-Jun-06 20:59
Memberzamco28-Jun-06 20:59 
AnswerRe: how do i use OpenCV code in windows forums Pin
zamco29-Jun-06 15:59
Memberzamco29-Jun-06 15:59 
QuestionQuestion about MC++ Marshall LParam to Struct Pin
ScottLeff26-Jun-06 10:38
MemberScottLeff26-Jun-06 10:38 
Question"Force file output" option in Visual Studio.NET Pin
dashprasannajit25-Jun-06 18:38
Memberdashprasannajit25-Jun-06 18:38 
Questionproblem Facing with c++/cli arrays Pin
Nagaraju_Focus23-Jun-06 21:07
MemberNagaraju_Focus23-Jun-06 21:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.