Recent

Author Topic: TCP Server in Android  (Read 5356 times)


trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: TCP Server in Android
« Reply #16 on: March 12, 2020, 01:51:42 pm »


Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1312
    • Lebeau Software
Re: TCP Server in Android
« Reply #18 on: March 12, 2020, 08:05:35 pm »
Yes, the problem is with android.
Others have the same problem

https://www.pilotlogic.com/sitejoom/index.php/forum/cross-build-development/3820-compile-android-library-include-indy-components-failed-cannot-find-liconv

That is not the same error that zeljkoc is experiencing.  That error shows the iconvenc unit being compiled fine (not including some hints), the project is just not linking to the actual iconv library.

In zeljkoc's case, the compiler is not even finding the iconvenc unit at all.

Does Indy depend on iconv?

On 'Nix platforms, yes.  Android uses Java running on top of Linux, and being that Indy is a native code library, it runs at the Linux layer, not at the Java layer.

Indy does a lot of operations that have to encode Unicode strings to byte arrays, and decode byte arrays to Unicode strings.  Now, certainly Indy could be updated to handle UTF encodings manually at least, but seeing that there are still many charsets being used in the world other than UTFs, especially for things like email, it would not be feasible for Indy to handle all of those charsets manually, so it uses platform APIs to handle them, such as iconv on 'Nix.

There are some higher level hooks available in Indy if you want to handle charsets manually in your own code (like the GIdEncodingNeeded event in the IdGlobalProtocols unit, and various methods that take a user-supplied IIdTextEncoding as a parameter), but I don't think there are enough hooks available at the lower level to completely break the iconv dependency at this time.  For instance, you could disable the USE_ICONV define in IdCompilerDefines.inc, but then you will have to manually provide an implementation for the TIdMBCSEncoding class in the IdGlobal unit, or else Indy's handling of UTF-7, UTF-8, and other non-UTF charsets will break at runtime.
« Last Edit: March 12, 2020, 08:29:04 pm by Remy Lebeau »
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

eljo

  • Sr. Member
  • ****
  • Posts: 468
Re: TCP Server in Android
« Reply #19 on: March 12, 2020, 08:29:49 pm »
Yes, the problem is with android.
Others have the same problem

https://www.pilotlogic.com/sitejoom/index.php/forum/cross-build-development/3820-compile-android-library-include-indy-components-failed-cannot-find-liconv

That is not the same error that zeljkoc is experiencing.  That error shows the iconvenc unit being compiled fine (not including some hints), the project is just not linking to the actual iconv library.

In zeljkoc's case, the compiler is not even finding the iconvenc unit at all.

Does Indy depend on iconv?

On 'Nix platforms, yes.  Android uses Java running on top of Linux, and being that Indy is a native code library, it runs at the Linux layer, not at the Java layer.

have you seen this https://github.com/d-mozulyov/UniConv ? it might be a better option don't know.

since you are here I'd like to ask if there is any documentation on what is required to port indy to a new OS I'm contemplating of porting to ultibo and wandering how complicated that might be.

balazsszekely

  • Guest
Re: TCP Server in Android
« Reply #20 on: March 14, 2020, 10:21:08 am »
@Remy Lebeau
Quote
Actually, GitHub does have an SVN interface, which does have a revision number.
Thanks. I will use the revision number from the SVN interface.

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1312
    • Lebeau Software
Re: TCP Server in Android
« Reply #21 on: March 14, 2020, 11:27:23 pm »
have you seen this https://github.com/d-mozulyov/UniConv ? it might be a better option don't know.

Interesting, but the goal is to not have to embed huge conversion tables into every app that wants to use Indy.  That is why Indy delegates to platform APIs for text conversions, let the OS handle them.

since you are here I'd like to ask if there is any documentation on what is required to port indy to a new OS

No, there is not.

I'm contemplating of porting to ultibo and wandering how complicated that might be.

Never heard of ultibo.  I don't have a clue what the requirements are for writing code for it.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

asdf1337

  • Jr. Member
  • **
  • Posts: 56
Re: TCP Server in Android
« Reply #22 on: March 14, 2020, 11:50:02 pm »
I'm contemplating of porting to ultibo and wandering how complicated that might be.

Never heard of ultibo.  I don't have a clue what the requirements are for writing code for it.

Would start with seeing what happens if you just compile it - maybe it works without that many changes if used the right defines (e.g. ultibo has Winsock 2.0 interface).
Otherwise you need to do all the low-level calls they use for creating/sending/receiving data through the socket (see https://ultibo.org/wiki/Unit_Reference#Network_units).

eljo

  • Sr. Member
  • ****
  • Posts: 468
Re: TCP Server in Android
« Reply #23 on: March 15, 2020, 12:37:35 am »
have you seen this https://github.com/d-mozulyov/UniConv ? it might be a better option don't know.

Interesting, but the goal is to not have to embed huge conversion tables into every app that wants to use Indy.  That is why Indy delegates to platform APIs for text conversions, let the OS handle them.

since you are here I'd like to ask if there is any documentation on what is required to port indy to a new OS

No, there is not.
A generic group list should get me started I guess.
so

1) sockets api (already provided)
2) uniconv  (as showed in this thread).

threading? something else that I might hit my head on?

Any way thank you for the info.


I'm contemplating of porting to ultibo and wandering how complicated that might be.

Never heard of ultibo.  I don't have a clue what the requirements are for writing code for it.
https://ultibo.org a baremetal framework to write your own firmware for raspberry PI. It has
 units for a lot of things.

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1312
    • Lebeau Software
Re: TCP Server in Android
« Reply #24 on: March 15, 2020, 09:58:33 pm »
A generic group list should get me started I guess.

It hass been a long time since Indy added a new OS.  All I can really offer you is this for now:

- go through IdCompilerDefines.inc and see if anything needs to be added/adjusted for ultibo.

- go through IdGlobal.pas and see if anything needs to be added/adjusted for ultibo.  Type declarations, handling of text encodings, etc.

- check if the existing TIdStack-derived classes are suitable for ultibo's socket API.  If not, you will have to write a new class, and then update IdStack.pas to assign that class type to the global GStackClass variable in the unit's initialization section.

threading?

Indy uses the RTL's TThread class, so threading support is the responsibility of FreePascal to handle.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

 

TinyPortal © 2005-2018