TCP Message Structure with XML

Posted by metdos on Stack Overflow See other posts from Stack Overflow or by metdos
Published on 2010-05-20T11:36:20Z Indexed on 2010/05/20 11:40 UTC
Read the original article Hit count: 200

Filed under:
|
|
|
|

Hello Everybody,

I'm sending messages over TCP/IP and on the other side I parse TCP message.For example this is one of the sent messages.

$DKMSG(requestType=REQUEST_LOGIN&requestId=123&username=metdos&password=123)$EDKMSG

Clarification:

$DKMSG(       //Start
)$EDKMSG      //End
requestType   //Parameter
REQUEST_LOGIN //Parameter Value

Now I also want to add an Xml file to my message. I'm considering this option:

$DKMSG(requestType=REQUEST_LOGIN&xmlData=
 <Item id="56D@MIT" type="SIGNAL">
 <Label>
 <Text>56D</Text>
 <X1>10</X1>
 <Y1>40</Y1>
 <RotateAngle>90</RotateAngle>
 </Label>
 <X1>0</X1>
 <Y1>20</Y1>
 <Width>35</Width>
 <Height>10</Height>
 <Source>sgs3lr</Source>
</Item>
)$EDKMSG

There are problems with this way:

1-)It doesn't seem right to me.

2-)I have to handle delimeter "=" with much more care or I need to change it in parameters.

What are your suggestions, thanks.

© Stack Overflow or respective owner

Related posts about c++

Related posts about tcp