comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: A few questions on parsing, sockets, UTF-8 strings
Date: Thu, 11 Aug 2016 18:23:54 +0200
Date: 2016-08-11T18:23:54+02:00	[thread overview]
Message-ID: <noi8r3$2p6$1@gioia.aioe.org> (raw)
In-Reply-To: 267bd80f-b388-4df6-b712-315ee9bda2b8@googlegroups.com

On 2016-08-11 16:39, john@peppermind.com wrote:
> 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?

Why not?

> 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.)

The user input buffer is the buffer you provide. TCP/IP stream ignores 
whatever line terminators. They are just bytes as anything else. You 
read until a complete line is in the buffer then do whatever you have to 
with the line.

> 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?

I have one:

http://dmitry-kazakov.de/ada/strings_edit.htm#12

There must be others surely.

P.S. There is no point using Base64 encoding over TCP/IP unless a 
specific protocol requires it.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2016-08-11 16:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-11 14:39 A few questions on parsing, sockets, UTF-8 strings john
2016-08-11 16:23 ` Dmitry A. Kazakov [this message]
2016-08-11 17:40   ` john
2016-08-11 17:49     ` Dmitry A. Kazakov
2016-08-11 18:22       ` john
2016-08-11 19:09         ` gautier_niouzes
2016-08-11 21:10         ` Dmitry A. Kazakov
replies disabled

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