TCP live stream buffer and expat xml parsing
Mikhail Strizhov <[email protected]> Sun, 18 Jul 2010 10:14:44 -0600
| Newsgroups | gmane.text.xml.expat.general |
|---|---|
| Message-ID | <[email protected]> |
Hi all, I have live tcp xml stream and each xml message has same format: <BGP_MESSAGE length="00001914" version="0.2" xmlns="urn:ietf:params:xml:ns:xfb-0.2" type_value="3" type="MESSAGE"> ...other_xml_items_here... </BGP_MESSAGE> <BGP_MESSAGE length="00002918" version="0.2" xmlns="urn:ietf:params:xml:ns:xfb-0.2" type_value="3" type="MESSAGE"> ...other_xml_items_here... </BGP_MESSAGE> <BGP_MESSAGE length="00002184" version="0.2" xmlns="urn:ietf:params:xml:ns:xfb-0.2" type_value="3" type="MESSAGE"> ...other_xml_items_here... </BGP_MESSAGE> When I'm calling TCP recv function to get data from socket I need to specify size of buffer, lets say 4096 bytes. Usually one <BGP_MESSAGE>..</BGP_MESSAGE> message is around 2500-3000 bytes. In this case I'm getting 1st full message and half of next. Afterwards I'm forwarding this buffer to XML_Parse function - 1st message parsed successfully, but 2nd is half parsed and then error messages. Is anybody know how to handle live tcp stream with libexpat? My code is large to attach, its available here - http://www.netsec.colostate.edu/~strizhov/bgpmon/bgpmonclient.c Thank you! -- *Sincerely,* *Mikhail Strizhov* *Email: [email protected] <mailto:[email protected]>*