comp.lang.ada
 help / color / mirror / Atom feed
From: Laurent <lutgenl@icloud.com>
Subject: Re: Problem with Unbounded Strings
Date: Fri, 4 Dec 2015 13:43:22 -0800 (PST)
Date: 2015-12-04T13:43:22-08:00	[thread overview]
Message-ID: <f29cf0ba-c0a4-4b85-8a2a-6533750d08f0@googlegroups.com> (raw)
In-Reply-To: <19i08yxoly6r5.lk9snum67ier.dlg@40tude.net>

On Friday, 4 December 2015 21:34:59 UTC+1, Dmitry A. Kazakov  wrote:
> On Fri, 4 Dec 2015 08:53:54 -0800 (PST), in comp.lang.ada you wrote:
> 
> > I don't use append?
> 
> No. There is nothing that is not in the buffer read already. Why would you
> append anything?
> 
> In some protocols payload data are accumulated from several packets.
> Unbounded_String is not used for that either. You want to limit the size of
> the accumulated data to prevent DoS attacks unless the protocol limits that
> already, as most protocols do. Simply keep the buffer in the communication
> object, that is all.

DoS attacks? Why should I care in this case. It is more an exercise/for fun. If the guy from the company which installed the communication apps is right, then I won't need to suck this informations from the log files. For the case that he is wrong and the informations haven't been stored somewhere on the server, the devs can write their own thing. I don't get paid for this. Is still better than watching the crap on tv.

> The point is to visit each source character just once and prevent excessive
> copying. That is also the reason why you practically never need or should
> not use Unbounded_String for I/O. It won't make your life easier anyway.
> You would have to convert it to String anytime you would use its contents
> as your code demonstrates. The code will be cleaner, safer and many times
> faster.

I don't have the necessary skills/experience to argument about this. 

I use the Unbounded Strings because I don't know in advance how many lines the message will be long. So I collect everything in a buffer, appending the following lines, so that it makes sense and when the message is complete, feed it to next procedure which slices of the interesting parts and uses them to generate a message object which I store somewhere or whatever if I should ever get so far.

A short example from the log file. Every new line begins with the time stamp. The only thing I want to get are those lines containing an <RS> and which is behind. Because the length of the lines is fixed to 121 chars, everything which is too long gets hard wrapped. If I don't put everything together I will lose informations, won't I?

[19/09/2015 00:05:39:526][INFO ]  <- <ENQ>
[19/09/2015 00:05:39:564][INFO ]  -> <ACK>
[19/09/2015 00:05:39:565][INFO ]  <- <STX>
[19/09/2015 00:05:39:565][INFO ]  <- <RS>mtmpr|pi2015120412345|pnTest_Name|pb08/08/1990|psF|si|ssURINES|stUrines spon
[19/09/2015 00:05:39:650][INFO ]  <- <RS>tanees|sp903775|pp903775|pa18/09/2015|s119/09/2015|s212:00|s319/09/2015|s412:04|
[19/09/2015 00:05:39:735][INFO ]  <- <RS>ci501509190001|ctAERO|sl100115|pl100115|pda|sxA|zz|
[19/09/2015 00:05:39:787][INFO ]  <- <GS>53
[19/09/2015 00:05:39:793][INFO ]  <- <ETX>
[19/09/2015 00:05:39:834][INFO ]  -> <ACK>
[19/09/2015 00:05:39:839][INFO ]  <- <EOT>
[19/09/2015 01:37:43:096][WARN ]  Handle event: TIMEOUT_EVENT HostResponseTimeout (3000 milliseconds)
[19/09/2015 01:37:43:096][INFO ]  <- <ENQ>
[19/09/2015 01:37:46:109][WARN ]  Handle event: TIMEOUT_EVENT HostResponseTimeout (3000 milliseconds)
[19/09/2015 01:37:46:109][ERROR]  Report Enq failure
[19/09/2015 01:37:46:109][ERROR]  Signal Enq failure
[19/09/2015 01:37:46:109][INFO ]  <- <ENQ>
[19/09/2015 01:37:49:119][WARN ]  Handle event: TIMEOUT_EVENT HostResponseTimeout (3000 milliseconds)
[19/09/2015 01:37:49:119][ERROR]  Report Enq failure
[19/09/2015 01:37:49:119][ERROR]  Signal Enq failure
[19/09/2015 01:37:49:119][INFO ]  <- <ENQ>
[19/09/2015 01:38:00:088][INFO ]  <- <ENQ>
[19/09/2015 01:38:03:096][WARN ]  Handle event: TIMEOUT_EVENT HostResponseTimeout (3000 milliseconds)
[19/09/2015 01:38:03:096][INFO ]  <- <ENQ>
[19/09/2015 07:09:32:624][INFO ]  -> <ENQ>
[19/09/2015 07:09:32:624][INFO ]  <- <ACK>
[19/09/2015 07:09:32:662][INFO ]  -> <STX>
[19/09/2015 07:09:32:782][INFO ]  -> <RS>mtrsl|pi2015120412345|p2185|pp906347|p5906347|si|s044587|ssHEMO|s5HEMO|ci5015091
[19/09/2015 07:09:32:879][INFO ]  -> <RS>70001|c044587|ctHEMOAE|ta|rtAST-N264|rr11437321|t11|o1esccol|ra|a1tem|a3<=4|a4S|
[19/09/2015 07:09:32:976][INFO ]  -> <RS>ra|a1am|a3>=32|a4R|ra|a1amc|a38|a4S|ra|a1tzp|a3<=4|a4S|ra|a1rox|a34|a4S|ra|a1tax
[19/09/2015 07:09:33:072][INFO ]  -> <RS>|a3<=1|a4S|ra|a1taz|a3<=1|a4S|ra|a1fep|a3<=1|a4S|ra|a1etp|a3<=0,5|a4S|ra|a1mem|a
[19/09/2015 07:09:33:169][INFO ]  -> <RS>3<=0,25|a4S|ra|a1an|a3<=2|a4S|ra|a1gm|a3<=1|a4S|ra|a1cip|a3<=0,25|a4S|ra|a1lev|a
[19/09/2015 07:09:33:266][INFO ]  -> <RS>3<=0,12|a4S|ra|a1tgc|a3<=0,5|a4S|ra|a1fos|a3<=16|a4S|ra|a1ftn|a3<=16|a4S|ra|a1sx
[19/09/2015 07:09:33:309][INFO ]  -> <RS>t|a3<=20|a4S|zz|
[19/09/2015 07:09:33:309][INFO ]  -> <GS>1c
[19/09/2015 07:09:33:332][INFO ]  -> <ETX>
[19/09/2015 07:09:33:337][INFO ]  <- <ACK>
[19/09/2015 07:09:33:375][INFO ]  -> <EOT>

  reply	other threads:[~2015-12-04 21:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-04 15:49 Problem with Unbounded Strings Laurent
2015-12-04 16:04 ` Dmitry A. Kazakov
2015-12-04 16:53   ` Laurent
2015-12-04 18:00     ` Niklas Holsti
2015-12-04 21:05       ` Laurent
2015-12-04 20:34     ` Dmitry A. Kazakov
2015-12-04 21:43       ` Laurent [this message]
2015-12-04 22:23         ` Dmitry A. Kazakov
2015-12-05 10:22           ` Laurent
2015-12-05 12:19             ` Dmitry A. Kazakov
2015-12-05 13:15               ` Laurent
2015-12-04 18:08 ` Jeffrey R. Carter
2015-12-04 21:21   ` Laurent
2015-12-04 21:59     ` Simon Wright
2015-12-04 23:19       ` Laurent
2015-12-04 22:02     ` Dmitry A. Kazakov
2015-12-04 22:28     ` Jeffrey R. Carter
2015-12-04 23:35       ` Laurent
2015-12-04 23:59         ` Jeffrey R. Carter
2015-12-05 10:13           ` Laurent
2015-12-08  1:53           ` Randy Brukardt
2015-12-04 23:00     ` Ben Bacarisse
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox