NetTalk Central

Author Topic: Returning Multiple Packets  (Read 4134 times)

CyberFerret

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • Email
Returning Multiple Packets
« on: February 22, 2008, 12:46:35 AM »
Hi all,

I have written a simple, manual NetWebPage using NetTalk which does some database operations and then returns the data as a straight XML packet.  eg:-

Loop recordptr = 1 to Records(somefilename)
  Get(somefilename, recordptr)
  packet = clip(packet) & '<tr>' & rec:somefieldsinhtmlformat & '</tr>'
End

With smaller data sets, the returned data comes up beautifully.  Note: We are using Prototype to do an Ajax.Updater call to this routine and embed the returned data into the calling web page table.

The problem is with larger data sets, the data gets 'chopped' after so many lines.  I am assuming this is because we are reaching the limit of what the 'packet' variable can hold.

The question is, how can we break this up into multiple packets in the procedure and return the data piecemeal?

Thanks,
Devan

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Returning Multiple Packets
« Reply #1 on: February 24, 2008, 10:43:09 PM »
Hi Devan,

I think the limit at the moment for a single "packet" is 16K. (This number doesn't actually mean anything - windows, routers, whatever, can all break packets apart and put others together. So 1 packet out does not necessarily mean 1 packet in the other side).

However you page can have as many packets as you like in it.
So all you need to do, is every so often, do a send.

In a NetWebPage this will most likely be
do SendPacket

ie your code can become

Loop recordptr = 1 to Records(somefilename)
  Get(somefilename, recordptr)
  packet = clip(packet) & '<tr>' & rec:somefieldsinhtmlformat & '</tr>'
  do SendPacket
End

cheers
Bruce

CyberFerret

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • Email
Re: Returning Multiple Packets
« Reply #2 on: February 28, 2008, 05:37:14 PM »
Bruce,

Your suggestion worked PERFECTLY!  I am continually amazed at the architectural consideration that has gone into NetTalk which makes things like this so easy to accomplish...Heck, who needs Ruby on Rails when you have Clarion on NetTalk??  :) :) :)

Cheers,
Devan