From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.176.2.179 with SMTP id 48mr6904231uah.1.1470926352868; Thu, 11 Aug 2016 07:39:12 -0700 (PDT) X-Received: by 10.157.44.69 with SMTP id f63mr228972otb.2.1470926352819; Thu, 11 Aug 2016 07:39:12 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!j37no7942658qta.0!news-out.google.com!d130ni31897ith.0!nntp.google.com!f6no9152554ith.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 11 Aug 2016 07:39:12 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2001:8a0:6a4f:fe01:b44b:9abb:7567:a522; posting-account=nd46uAkAAAB2IU3eJoKQE6q_ACEyvPP_ NNTP-Posting-Host: 2001:8a0:6a4f:fe01:b44b:9abb:7567:a522 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <267bd80f-b388-4df6-b712-315ee9bda2b8@googlegroups.com> Subject: A few questions on parsing, sockets, UTF-8 strings From: john@peppermind.com Injection-Date: Thu, 11 Aug 2016 14:39:12 +0000 Content-Type: text/plain; charset=UTF-8 X-Received-Bytes: 2000 X-Received-Body-CRC: 2385165994 Xref: news.eternal-september.org comp.lang.ada:31387 Date: 2016-08-11T07:39:12-07:00 List-Id: Hi! For some non-standard interprocess communication, I need to: 1. Listen with a TCP socket to the local loopback interface and obtain the PORT suggested by the OS, i.e. like with bind() to port 0 and getsockname() in C. Is this possible with GNAT.sockets? 2. Connect to the incoming host and parse input and send output delimited by LF line-by-line. What about buffering, can it be switched off or is there a line buffer mode already? (It needs to be compatible with LF instead of CR+LF as delimiter, though.) 3. Convert back and forth between Base64-encoded UTF-8 strings and UTF-8 strings (which may also be represented in the source text). How do I do this? Especially the last point is a bit mysterious to me. I cannot use UCS-2, it needs to be full UTF-8. Should I use a library for UTF-8 strings? Which one? Speed is not very important, but I'd like to avoid unnecessary conversions.