How to efficiently determine the End-of-Transmission for an XML-based text protocol?

I want to develop an XML-based text protocol and communicate over TCP / IP sockets. Let's say I have a simple request / response mechanism for sending over a permanent TCP / IP connection between the client and server:

<?xml version="1.0" encoding="UTF-8"?>
<request id="1" command="get.answer">
    <value type="string">Answer to the Ultimate Question of Life, the Universe, and Everything</value>
</request>

<?xml version="1.0" encoding="UTF-8"?>
<response id="1" command="get.answer">
    <value type="int32">42</value>
</response>

When will each party begin to process incoming data, or in other words, when does the server know that the incoming client data is completely transmitted and can be processed to create a response?

Of course, I did some research on this topic: I found this answer that points in the right direction based on the HTTP example: Therefore, using a kind of "Transmission Protocol" over XML messages will certainly help.

XML- XMPP, " ", HTTP, , .

RFC 6120 "2.4. " :

XMPP XML ( ), XML "stanza", XML, . (, "" "" ), .

, XML TCP/IP , End-of-Transmission XML, \r\n - . , ()?

+3
4

, XMPP XML- . , , , XML, XMPP.

, , . 3 (IQ, Message Presence), ( ).

TCP-, , HTTP, XMPP .

- , , XML-, . , , .

XMPP, .

+2

XMPP XML-, @Robin. HTTP BOSH.

(HTTP) . Strophe, , js BOSH, HTTP- , , Content-Length. :

POST /webclient HTTP/1.1
Content-Type: text/xml; charset=utf-8
Content-Length: 240

<body rid='1573741825'
      sid='SomeSID'
      xmlns='http://jabber.org/protocol/httpbind'>
  <iq id='bind_1'
      type='set'
      xmlns='jabber:client'>
    <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
      <resource>httpclient</resource>
    </bind>
  </iq>
</body>

( XML), -. , python, , Twisted, python Expat XML parser. - , , , , , "" . , .

0

, : . , XMPP. , XML- , , . , , , , . . , - . , , /XML.

0

XMPP XML. , , , ( ) ( , XML).

<?xml version="1.0" encoding="UTF-8"?>
<request id="1" command="get.answer">
    <value type="string">Answer to the Ultimate Question of Life, the Universe, and Everything</value>
</request>

, , <request, , XML , </request>.

( , , raw xml (TCP), , 4 .)

0

All Articles