; rss.vnm ; test parsing an RSS feed with Protocol analyser ; ; Illustates fetching a simple http URL and use of the ; protocol analyser V2. ; Needs June 2007 or later version of Venom. ; site-specific definitions. You WILL have to change these! DEFINE my_ip "172.16.1.150" DEFINE my_nameserver "172.16.1.146" DEFINE my_gateway "172.16.1.199" TO init MAKE eth Protocol("eth", 1, $d) eth.Address('i') := my_ip eth.Address('n') := my_nameserver eth.Address('d') := my_gateway MAKE tcp Protocol("tcp") MAKE pa ProtAnalyser(tcp, 0) MAKE s String(100) END TO main ; note how the URL "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml" ; is broken down. ; HTTP uses port 80, which we use when opening the connection. ; "newsrss.bbc.co.uk" is is the hostname, which we use when opening the connection and ; again in a "host:" header after sending the GET request ; "/rss/newsonline_uk_edition/front_page/rss.xml" is the path we specify in the GET request ; IF tcp.Open("newsrss.bbc.co.uk", 80) [ PRINT "http connection opened",CR PRINT TO tcp, "GET /rss/newsonline_uk_edition/front_page/rss.xml HTTP/1.1",CR, "host: newsrss.bbc.co.uk",CR, CR PRINT "=headers=",CR WHILE tcp.Get(s) > 0 ; read headers until we get an empty line = end of headers PRINT s, CR PRINT "==",CR pa.Reset ; every title we want to display is a