Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: tcp ports and buffer size? Holger?

From: twatkins:datajunction at: 30-Aug-2001 9:12

I am not a Rebol expert, but I would suspect that it may have something to do with TCP/IP packet sizes. If you receive a packet smaller than your buffer, Rebol sees that there was not enough data to fill the buffer, and so might assume that the transfer is complete. If you receive a packet larger than your buffer, Rebol is probably smart enough to detect that there is still more data waiting to be received, and so will continue receiving until it cannot fill the buffer. Just out of curiosity, why is the term Rebolish used in stead of Rebollious? To Rebel is to be Rebellious, and so it seems to me that to Rebol, is to be Rebollious Just a thought. -Terwin ----- Original Message ----- From: "Petr Krenzelok" <[Petr--Krenzelok--trz--cz]> To: <[rebol-list--rebol--com]> Sent: Thursday, August 30, 2001 5:27 AM Subject: [REBOL] tcp ports and buffer size? Holger? Hello, today I needed to increase number of our downloadable mainframe files. This time - first ones from SAP R3. Not much of a problem, unix-like ftp we don't have access too, so I have to wrap company website using post method to get files. However, download of two of my files ended with 4096 bytes of downloaded data. I wondered why and found out some strange behavior I don't understand. I have following code: http-port: open [ scheme: 'tcp port-id: port-spec/port-id timeout: port-spec/timeout host: port-spec/host user: port-spec/user pass: port-spec/pass ] ;inserts 'post request insert http-port http-request ;uncomment the next line if you wish to skip some amount of info ;http-port: skip http-port 2000 view/new layout [ styles styly vh2 gold "Stahuji soubor, čekejte prosím ..." across lab "Staženo: " p: text 80 bold right white "0" return lab "Čas:" t: text 80 bold right white "0" ] l: 0 start: now/time while [data: copy/part http-port buffer-size][ print mold data append target-port data l: l + (length? data) p/text: to-string l t/text: to-string now/time - start show p show t ] print type? data close http-port close target-port So, basically, I used pure 'open - no other refinement. No matter if I used pure while [data: copy http-port], I always ended with file of 4096 bytes size. I even tried to use "wait http-port" inside of 'while block, but no success - "print type? data" following the loop always reported 'none. I also tried to use /no-wait refinement, but still the same. I have buffer-size defined 20000. Now I lovered buffer size to be less than those mystery 4096 bytes, to 2000, and my file was downloaded correctly. So, what am I doing wrong? - why 'copy doesn't block if I don't use /no-wait refinement? - why using /no-wait and while [data: copy http-port] copies those 4096 bytes, then leaves loop, reporting data being none!, while it should be an empty string instead? (waiting for port doesn't help here, loop is left anyway ...) My temporal solution is to use low enough buffer size and copy/part http-port buf-size .... Thanks a lot, -pekr-