01-03-2008 02:11 PM
01-04-2008 09:13 AM
01-04-2008 03:03 PM
Hi Anil,
Another option would be to place the TCP Read VI inside a while loop and read until an error occurs. By connecting the error out of the TCP Read to the conditional terminal of the while loop, the loop will stop on an error. Example HTTP Protocols on DeveloperZone has code that demonstrates this.
06-26-2008 03:31 AM
Not sure if that last link to http helped you. It sure helped me, i will have to remember error 66.
However, i'm working on some UPNP and Soap calls to devices on the network and i wrote some send recieve vi's. What i noticed was all my devices return 8 lines which i consider a Header. It includes the HTTP OK, some device info and Content-Length: What i do is send my TCP Soap call then read in a for loop, 8 times. Using CRLF as the end byte for each loop. then as i recieve each line i check for Content-Length: and if its there i pull out the number and save it in a shift register. then after the loop ends i convert string number to dec number and then do one more read with that number for the bytes to read. I'm not getting big files sent back to me so i think im okay. not sure what would happen if i tried to read a big file that way. Probably crash.
So my other thought was that if you only get like 3 lines in the header then my vi wouldn't work. so maybe you read until you recieve an empty string, which is the standard. To send a blank line at the end of each response. Then after that the data is read. Based of the parsed Content-Length:
Hope this helps someone. Maybe i can put my vi's together and post what i have if anyone is intrested.
06-26-2008 07:33 AM
Hi pRoFiT,
see this link please: http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=324049#M324049. The example shows in the "get" case how you can read the response.
Hope it helps.
Mike