Re: [twsocket] Newbie question : Working with Long strings
Hello Clément, > Ok. But can I place a LineLimit over 200kbytes? or better yet, > unlimited? (those help files can get very big may be over 1Mb) Yes. Since you connect to a known server you dont have to be afraid of a DOS attac. So set LineLimit := $7FFF; which is the highest possible value. TWSocket will then buffer the data for you until the terminating character is received and then OnDataAvailable will fire where you can receive the whole data at once. > Can I set the LineLimit at runtime at any time? You can set it at any time, but I think (see above) it is not needed for you to change it the whole time. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Newbie question : Working with Long strings
Hello Wilfried, Thanks for helping me! > Hello Clément, > > >> I searched some examples, but most of them use LineMode and LineLimit. I'm >> afraid >> that's not an option. >> > > Wy is that not an option ? What is the problem with it ? Just terminate > your data with a charcter that cannot be in the data itself and your > whole problem is solved. > > Ok. But can I place a LineLimit over 200kbytes? or better yet, unlimited? (those help files can get very big may be over 1Mb) Can I set the LineLimit at runtime at any time? Where/when should be the correct place to update LineLimit? For example, once I check the data length is larger then the limit, then I add a few more bytes, save this new limit in a .ini for example. Best regards, Clément -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Newbie question : Working with Long strings
Hello Clément, > I searched some examples, but most of them use LineMode and LineLimit. I'm > afraid > that's not an option. Wy is that not an option ? What is the problem with it ? Just terminate your data with a charcter that cannot be in the data itself and your whole problem is solved. > // here I expect "Len" <= BufSize. If it's equal than "may be" there's > more to > // read. How can I be sure? Does ICS have some internal flag ? You cannot. ICS also cannot have a flag. Data can be somwhere on the way or send may send some more data. winsock cannot know what sender wants. > if Len = 0 then begin >// Something happened!! What? Winsock does not like to let us receive data, so exit the event. > if Len=-1 then begin >// Seems to be the end of a long string. Once len = -1, can No it is not a long string. -1 is an error. just exit the event. > // Now the problem: > // I must cache the received zBuf > FRcvBuf := FRcvBuf+ string(zBuf); > // If we read all the data, we display it If you have a problem with linemode, the send first the length of the data you want to send. then receiver has length and can concatenate all data packets until it is same as the length. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be