(04-28-2018, 05:57 AM)BartKindt Wrote: I tried this:
IdTCPClient1.Socket.Binding.SetBinding(NetworkData.LocalIP,APort);
You don't need to call SetBinding() manually, Indy handles the binding for you, using the values of the BoundIP and BoundPort properties.
(04-28-2018, 05:57 AM)BartKindt Wrote: What function is the Port in this case? Does this have any effect on setting the socket, and if so, what Port am I supposed to use?
It is the local Port that the client binds to before connecting to the remote server. A TCP connection is uniquely identified by the combination of the socket's protocol, client's bound IP/Port, and the server's bound IP/Port.
(04-28-2018, 05:57 AM)BartKindt Wrote: Then,
SetSockOpt(ALevel: TIdSocketOptionLevel; AOptName: TIdSocketOption; AOptVal: Integer);
Those are three integers I am supposed to supply. I have no idea what these mean.
Read the Linux man documentation for the setsockopt() function, and the SO_BINDTODEVICE socket option in particular:
https://linux.die.net/man/2/setsockopt
https://linux.die.net/man/7/socket
(04-28-2018, 05:57 AM)BartKindt Wrote: Also, after hours digging through the Android API (24) help, I cannot find any way to retrieve an integer which I could use to call SetSockOpt() with.
Android runs on top of Linux. Indy accesses Linux's socket APIs directly, it does not use Android's APIs.
(04-28-2018, 05:57 AM)BartKindt Wrote: Going through the source of Indy, it ends with an GStack.SetSocketOption(Handle, ALevel, AOptName, AOptVal); overload; virtual; abstract;
of which I cannot find the actual source code to see what it does...
On Android, it is implemented in the Lib\System\IdStackVCLPosix.pas source file.
(04-28-2018, 05:57 AM)BartKindt Wrote: PS: After I assign the "IdTCPClient1.IOHandler := IdSSLIOHandlerSocketOpenSSL1;" , calls to the IdTCPClient1.Socket.Binding.SetBinding will be passed on to IdSSLIOHandlerSocketOpenSSL1 where required?
Yes. Connect() handles that for you.