by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 02 02:01

    rlebeau on FTP-Active-Mode-Fix

    (compare)

  • Jun 27 00:35
    rlebeau commented #311
  • Jun 27 00:33
    rlebeau labeled #311
  • Jun 27 00:33
    rlebeau labeled #311
  • Jun 27 00:32
    rlebeau commented #311
  • Jun 26 14:48
    JoeSansalone edited #311
  • Jun 26 14:47
    JoeSansalone opened #311
  • Jun 26 11:28
    mezen commented #299
  • Jun 25 18:36
    rlebeau commented #299
  • Jun 25 18:36
    rlebeau commented #299
  • Jun 25 16:23
    rlebeau closed #310
  • Jun 25 08:03
    mezen synchronize #299
  • Jun 24 17:13

    rlebeau on master

    #310 Updating TIdFTP.Login() to… (compare)

  • Jun 24 17:06
    rlebeau assigned #310
  • Jun 24 17:02
    rlebeau edited #310
  • Jun 24 16:59
    rlebeau labeled #310
  • Jun 24 16:59
    rlebeau labeled #310
  • Jun 24 16:59
    rlebeau labeled #310
  • Jun 24 16:59
    rlebeau opened #310
  • Jun 22 22:14

    rlebeau on master

    #308 Updating .bat files for De… (compare)

orexsys
@orexsys
I set the listener (idtcpserver), set the idtcpclient for the remote connection and try to connect. TcpClientR fires OnConnect event, but when i try to send data using
code TCPClientR.Socket.WriteLn('This is a TEST');
OnExecute is not fired on the remote client
Tcpclient is used to connect with the randevouz server
Remy Lebeau
@rlebeau
@orexsys which SO post are you referring to exactly? Why aren't you using a standard client/server connection? What does your rendezous server code look like? Indy clients don't have OnExecute events, did you mean TIdTCPServer instead? What are you trying to hole punch exactly, and why? You didn't explain your network setup for this scenario.
I want 2 client apps to exchange data without opening ports in routers
I know that indy clients don't have OnExecute. I was refering to the IdTCPServer in the remote app.
orexsys
@orexsys
Randevouz server on a cloud PC running server.exe, 2 clients (client.exe) running on 2 remote locations, trying to talk to each other without opening ports in routers.
When a client (client.exe) connects with the server, server stores their ID, global IP and Port in a list. When a client wants to connect to another client, it sends a command to the server stating the ID of the client it wants to connect to. Server sends to both clients the other party's global IP and Port and the code that i have sent you runs on both client apps.
orexsys
@orexsys
In both clients a get an event that the IdTCPClient is connected. But as i told you a do not receive any data when i try to send something from one client app to each other
Remy Lebeau
@rlebeau
@orexsys please stop chatting for a minute, I'm trying to think this through...
@orexsys It makes sense that a TIdTCPServer's OnConnect and OnExecute events may not work in this scenario, as hole punching can bypass the traditional accept() call that a server makes to accept an inbound connection. So there maynot be any "accepted" connection for your TIdTCPServer to wrap into a worker thread to hook up those events with. TCP Hole punching is used to make 2 clients talk directly to each other, would can bypass a typical server socket. So there may not be any OnConnect/OnExecute events for Indy to fire in this scenario. Also, reading the hole punching article, are you enabling ReuseSocket=rsTrue on both the TIdTCPClient AND TIdTCPServer that you are performing the hole punching with? I don't see that in the code above. Also, the article says you need 2 client sockets to punch with, each one connecting to the other peer's public AND private IP/ports at the same time, but your code above is only using 1 client socket. Each client machine connected to the rendezous server needs to register their public AND private IP/Ports, but you are only registering the public IP/port as seen by TIdContext
Remy Lebeau
@rlebeau
@orexsys I think you need to re-read the article more carefully in section 4 on TCP hole punching, you seem to be missing some steps. https://bford.info/pub/net/p2pnat/
orexsys
@orexsys
Yes i use ReuseSocket=rsTrue on both the TIdTCPClient AND TIdTCPServer. You are correct i am not trying to connect using the private IP/PORTS, i only use the Global IP/Port.
Remy Lebeau
@rlebeau
@orexsys you need to connect to BOTH public AND private IP/Port at the same time, or else this hole punching doesn't work. Read the article more carefully. And I even stated this in my SO post: "When hole punching in TCP, each client needs at least 4 sockets - 1 connected to the rendezvous server, 1 listening locally (TIdTCPServer or TIdSimpleServer), and at least 2 trying to connect to the other client's public/private endpoints. All 4 sockets must be bound to the same local port, which means setting ReuseSocket=rsTrue on all 4 sockets." And BTW, this all hinges on your router even supporting this technique. Not all do. So your code may be flawless and this might still not work.
@orexsys are BOTH peers behind routers? If not, have you tried simpler Relaying and Connection Reversal techniques also discussed in the article? Hole Punching should be a last resort with other techniques fail.
orexsys
@orexsys
@rlebeau i know that not all routers support this and did not add the code for private IP/Port as the code above managed to get the IdTCPClient connected to the remote IdTCPServer !!! The problem as you stated, is that IdTcpServer does not spawn a new thread to handle the events. Can this be resolved somehow ? I know about the use of relay servers, but this is CPU and bandwidth comsuming (relaying all data through a 3rd server)...
Remy Lebeau
@rlebeau
@orexsys Just because the punching TIdTCPClient thinks it is connected doesn't mean it ACTUALLY IS, clearly it is not, since you are missing code for half of the punching equation. Fix that first, and then the other peer's TIdTCPServer may actually see the connection appear properly and fire its events. But there is no guarantee the punched connection will show up on the TIdTCPServer, it may show up on one of the TIdTCPClients instead. So you have to be prepared to discover which 1 of the 3 (not 2!) different sockets actually has the full connection. This is clearly explained in the article. So go work on that for awhile, add the missing private IP/port registration to your rendezous server and the missing 2nd TIdTCPClient to each peer, and if it still doens't work then come back here
orexsys
@orexsys
@rlebeau Ok, i got it, one last thing. It is not clear to me how to check which socket has the full connection. Any hints on how to do that ? And thank you very much for your time, really appreciate it !!!
Remy Lebeau
@rlebeau
@orexsys again, read the article, this is all covered in it. Once a socket is "connected", try communicating over it. If that fails, close that socket, create a new one, and try again. Eventually, 1 of the sockets on a peer may be able to communicate back and forth with 1 of the sockets on the other peer (router permitting). That is your full connection, you can then close all of the other sockets. You need to implement some kind of protocol over that connection so the peers can validate they are talking to each other.
orexsys
@orexsys
@rlebeau Thank you for clarifying it. Have a very good day. Thank you for all the help...
SyntecBusiness
@SyntecBusiness
@rlebeau thank you for your assistance, after upgrading to 10.4 and fixing my project to compile there, using IdOpenSSLSetLoadSymLinksFirst(False) with setting the .so file names to .so.1.0.2 now works on the android devices that were failing before
y-mair
@y-mair

Hello, I hope anyone can help me using the TIdTCPClient in delphi. I want a communication with a payment terminal. This device is in the network via static ip adress. The connection works, but when I try to send data to the terminal, I never get a response. When I execute the line Client.SendCmd() the terminal switch the light on so it reacts to the command, but the program also freezes in this line and I don't get any response.

Heres my code snippet:
Client.Host := '192.168.0.151';
Client.Port := 5577;
Client.Connect;
Client.SendCmd('1', outp);

Does anyone know the error and can help me?

Kudzu
@czhower
Use Write instad of SendCmd. SendCmd waits for an RFC style response.
Remy Lebeau
@rlebeau
Client.Write() or Client.WriteLn(), depending on whether or not the terminal expects a CRLF at the end of the command
Ferhat YILDIRIM
@3ddark_gitlab
Hello everbody,
How can i disconnect manualy on server. İ use idtcpserver.contexts.locklist arter find in list then acontext.connection.disconnect
Bu taking invalid handle error
Remy Lebeau
@rlebeau
@3ddark_gitlab that will generally work, but it could also be a platform-related issue (what platform are you targetting?), or maybe the client had already disconnected but its context hadn't been removed yet.
Andrew Hill
@andyhill_gitlab

I am using Delphi 10.3 with default Indy and the latest UniGUI to create stand alone WebServers that bind to different IP's on the same win10 pro PC NIC. All good until I use SSL.
When I use SSL it appears that Indy binds to every IP when port 443 is involved. Each WebServer has one binding record with Port 80.

eg. order of IP binding

xxx.xxx.xxx.010 WebServer A (no SSL) FINE
xxx.xxx.xxx.011 WebServer B (no SSL) FINE

xxx.xxx.xxx.010 WebServer A (SSL) FINE
xxx.xxx.xxx.011 WebServer B (no SSL) FINE

xxx.xxx.xxx.010 WebServer A (SSL) FINE
xxx.xxx.xxx.011 WebServer B (SSL) FAILS SAYS "CANNOT BIND SOCKET"

xxx.xxx.xxx.011 WebServer B (SSL) FINE
xxx.xxx.xxx.010 WebServer A (SSL) FAILS SAYS "CANNOT BIND SOCKET"

Am I to understand that I need 2 bindings on each WebServer for each IP:-

[0]xxx.xxx.xxx.010:80
[1]xxx.xxx.xxx.010:443

[0]xxx.xxx.xxx.011:80
[1]xxx.xxx.xxx.011:443

Please advise - Thanks in advance

Remy Lebeau
@rlebeau
@andyhill_gitlab the standard non-SSL HTTP port is 80, and the standard SSL/TLS HTTPS port is 443. So yes, you need separate bindings for each port if you want to handle HTTP and HTTPS traffic on the same machine. Indy's TIdHTTPServer has a Bindings property for that purpose, make sure you set it up correctly (ie, it is very common for Indy beginners to NOT set up multiple bindings correctly). TIdHTTPServer also has an OnQuerySSLPort event that you can use to specify which Binding port(s) use SSL/TLS and which do not, if needed. There was once a bug where TIdHTTPServer tried to use HTTPS on non-HTTPS ports, but that was fixed awhile ago, but I'm not sure whether that fix made it into the Indy that shipped with 10.3.
Andrew Hill
@andyhill_gitlab
Thank you Remy, I will implement and test
Andrew Hill
@andyhill_gitlab

Sadly, makes no difference

If NIC Binding[0] xxx.xxx.xxx.010 has Port 80 and Binding[1] xxx.xxx.xxx.010 has Port 443

and NIC Binding[0] xxx.xxx.xxx.011 has Port 80 and Binding[1] xxx.xxx.xxx.011 has Port 443

we cannot use 443 on xxx.xxx.xxx.011 globally locked by xxx.xxx.xxx.010 above.

Please help.

Remy Lebeau
@rlebeau
@andyhill_gitlab that is not how NIC bindings work. Binding a port on one IP does not effect binding the same port on another IP. So either you are not actually setting up the Bindings properly, or something else on the machine is already using xxx.xxx.xxx.011:443. Are you setting up the Bindings at design-time, or in code at runtime?
Andrew Hill
@andyhill_gitlab
Remy, The boys from UniGUI claim it is an issue with Indy BUT after exhaustive testing it appears that they have bound 443 globally without realizing it, I have come up with a work around - thank you for your help.
Kudzu
@czhower
@andyhill_gitlab They blame Indy for a lot. But their code is problematic in many areas. Just wait till you put a serious load on a UniGUI application and see what happens...and its NOT Indy as IntraWeb uses Indy too without issues.
mezen
@mezen
I think I have a problem with TIdFTP and its Field FUsingSFTP. I am connecting to a FileZilla which forces PROT P with utUseImplicitTLS. Calling TIdFTP.Connect() sets TIdFTP.FUsingSFTP to True. Calling TIdFTP.Login (because of TIdFTP.Autologin = False) sets TIdFTP.FUsingSFTP back to False. When trying to call TIdFTP.Listthe method TIdFTP.SendDataSettings does nothing and do not send a PROT P. The result is an error code from the FTP Server "PROT P required".
If I change to TIdFTP.Autologin = Trueand omit the call of Login, everything works.
Remy Lebeau
@rlebeau
@mezen I have opened a ticket: IndySockets/Indy#310
Remy Lebeau
@rlebeau
@mezen I just checked in an update. Let me know if it works for you, so I can close the ticket.
mezen
@mezen
@rlebeau the fix seems to work fine, thanks.
I also added a small commit to my OpenSSL io handler push request. FTP server like FileZilla could enforce a tls session resumption for the data channel (reuse of the tls session of the command channel) to prevent connection stealing. For more information see the forum post https://forum.filezilla-project.org/viewtopic.php?p=137191#p137191.
Halil Han
@halilhanbadem
Hi guys
Halil Han
@halilhanbadem

I have a question.
I am using idHTTPServer. When I send a POST request with HTML, it doesn't see my request.
When I check with ARequestInfo.Command it accepts "POST". But; ARequestInfo.PostStream comes in nil.
How can I handle this job?

Detailed link of my question: https://stackoverflow.com/questions/62579750/capturing-html-post-with-delphi

Thanks.
Regards.

Remy Lebeau
@rlebeau
@halilhanbadem I just posted an answer on SO
Halil Han
@halilhanbadem
Thank you so much @rlebeau
Remy Lebeau
@rlebeau
@halilhanbadem I have updated the answer with more info
Halil Han
@halilhanbadem
@rlebeau I really want to be like you in the future :) Thanks again.
Remy Lebeau
@rlebeau
@halilhanbadem I updated the answer with some more info. I'm done now
Halil Han
@halilhanbadem
Thank you master :D