PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Force update when using WindX packet compression  (Read 559 times)

Jeff Wilder

  • Silver Member
  • ***
  • Posts: 41
    • View Profile
Force update when using WindX packet compression
« on: August 30, 2022, 06:34:52 PM »
Hello,
I stumbled across an unexpected behavior today and was hoping somebody on here could explain if I am doing something wrong. When the '+W' system parameter is enabled for WindX data packet compression, the UI does not appear to update as I expect it to. Specifically, I sometimes use the WAIT 0 directive to force an update of screen controls while I'm processing something. This is most commonly done for a progress bar for example. When the +W parameter is enabled, the WAIT 0 no longer causes a UI control (screen) update. Below is an example program that illustrates this behavior. I'm using PxPlus 18.20. When the program is executed in a CS client connected WindX session, the print statements are shown after the WAIT directives while +W is off. However, when +W is on, the print statements do not display until the program ends. At which time, they all appear at once. Am I using the WAIT directive improperly?

Thank you,
Jeff

Code: [Select]
0010 BEGIN
0020 SET_PARAM -'+W'
0030 FOR 2
0040 PRINT "Hello World!"
0050 WAIT 0
0060 ! Now go off and do some processing....
0070 GOSUB 0160
0080 ! In PxPlus CS WindX, the print statement doesn't print until the program ends
0090 PRINT "Update the display."
0100 WAIT 0
0110 GOSUB 0160
0120 SET_PARAM '+W'
0130 NEXT
0140 PRINT "Complete"
0150 END

0160 ! Emulate some processing code
0170 FOR I=1 TO 7000000
0180 LET X=I/(RND(I)+1)
0190 NEXT
0200 RETURN

Mike King

  • Administrator
  • Diamond Member
  • *****
  • Posts: 3698
  • Mike King
    • View Profile
    • PVX Plus Technologies
Re: Force update when using WindX packet compression
« Reply #1 on: August 31, 2022, 02:49:55 PM »
When you have compression enabled the system will automatically buffer small packets up so that the compression actually saves you transmission time.

For example if you compress the string "Hello World" the output actually doubles in size:

->x$="Hello World"
->print len(x$)
 11
->c$=cmp(x$)
->print len(c$)
 23
->


This is due to the overhead of the compression algorithm which is the same one as used by ZIP.

->x$=dim(1000,"The quick brown fox jumped over the lazy dogs back")
->c$=cmp(x$)
->print len(c$)
 70
->print len(ucp(c$))
 1000
->


If you wish to force a flush when using compression the only method is to request something from the workstation such as requesting the value of MSE or FIN(0).


Jeff Wilder

  • Silver Member
  • ***
  • Posts: 41
    • View Profile
Re: Force update when using WindX packet compression
« Reply #2 on: September 07, 2022, 01:48:26 AM »
Thank you Mike! That makes perfect sense. I will change the code to use MSE instead of WAIT 0 when I truly need to force an update which is quite rare.