When a client connects to my TCP server, i can identify him via:
AContext.Binding.PeerIP
This works for clients in a local network, and also for remote clients.
But on some sites there are 2 routers.
So the TCP-port has to be forwarded in both router.
This means that all clients that are connecting remotely are identified as '192.168.1.1' instead of with their own IP address.
When i am doing the same with a DataSnap server, i can use:
IpAddress := Session.GetData('RemoteIP');
This gives back the 'real' clients IP, event through both routers.
So, is there a way to do the same with an Indy TCP-server?
Related
I can successfully SSH into my server if I connect that PC directly to my ISP provided router (point 1 below), with port forwarding etc.
However I need to connect another router as an access point first, and then connect my server PC to that router(point 2 below).
Thus the connection changes from:
1. ISP router - LAN cable - Server PC
TO:
2. ISP router - LAN cable - access point router - LAN cable - Server PC.
I just plug the LAN cables in as in the second scenario above, and internet etc works on all my PC's, including the Server PC. I have tried changing IPv4 settings, port forwarding on both routers etc.
You either:
port forward (1) from your ISP router to your AP router and port forward (2) from your AP router to your sever PC (fixed IP)
or you inform the ISP router of the subnet created by the AP router, by adding the subnet to the ISP's routing table (if you've access to the routing table).
Or, unless you really need the AP to act as a router, check if you can configure it as a regular switch so the whole network will be one subnet. Doing so, you can stick to your initial setup.
I am using Windows 10 with IIS 10.0
I am publishing website on IIS and I need to reach it with public ip.
What I did;
* Port forwarding through router
* Adding DMZ with my local IP
* Turning off firewall
* Adding port to firewall inbound rules with allow edge traversal
I can connect with internal IP like 192.168.1.75:81
I get "System.Net.Sockets.SocketException A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond from [MYPUBLICIP]" when I try to reach it like MYPUBLICIP:81
What are the possible scenarios that blocks to port?
Thanks.
As far as I know, the error message means there is no server listening at specified ip/port that you are trying to connect to.
In my opinion, you should firstly make sure your client machine could access your server by using this MYPUBLICIP address.
Then I suggest you could try to make sure the port 81 is your IIS web application port.
Besides, I suggest you could try to open your event viewer to find out the details error message.
I use TIdUDPServer in this scenario:
Host 192.168.1.10: IdUDPServer1.Active := True using dynamic port (e.g.: 60112)
Host 192.168.1.20: IdUDPServer2.Active := True using dynamic port (e.g.: 50332)
When I invoke IdUDPServer1.Send('192.168.1.20', 50332, 'Hello'), the host
192.168.1.20 didn't receive any UDP message.
I then invoke IdUDPServer2.Send('192.168.1.10', 60112, 'Hello'), the host 192.168.1.10 receive the UDP message. Both hosts are able to receive UDP messages from each other then.
Similarly, if I send message from IdUDPServer2 first, the IdUDPServer1 will not receive any UDP message.
This strange problem always happens to UDP server that first send a message.
This problem doesn't happen if both IdUDPServer1 and IdUDPServer2 started in same host (e.g.: localhost or same pc).
I didn't assign any port number to both TIdUDPServer instance and let the library to assign a dynamic port for me. Hence, Windows 10 didn't prompt any Firewall warning.
I want to write a n-tier application, where the server part can be hosted on the customer site or our company can host the server part (for each customer) on our machine (over the internet).
When our company is hosting the customers server part. We then have to run the same server application multiple times (for each customer). I don't want to change and maintain the port numbers for every server instance.
So my question is: Is it possible to run the same server app with the same port mapping on the same machine? Just specifying a unique uri/url in the server app? like:
http://10.0.0.127:8090/customer_1/
http://10.0.0.127:8090/customer_2/
I am using Indy components for client/server communication.
The only way multiple servers can listen on the same port on the same machine is if they are bound to different IP addresses. Otherwise, you have to use different ports.
The alternative is to host just one HTTP server and utilize HTTP 1.1's virtual host feature (via the Host header, which is a required header in all HTTP 1.1 requests) to differentiate between different customer sites on the same server, eg:
http://customer1.myserver.com:8090/ generates:
GET / HTTP/1.1
Host: customer1.myserver.com:8090
http://customer2.myserver.com:8090/ generates:
GET / HTTP/1.1
Host: customer1.myserver.com:8090
Your server can look at the Host header to know which customer site to access.
Read RFC 2616 Section 19.6.1.1 for more information:
Changes to Simplify Multi-homed Web Servers and Conserve IP Addresses
I am building a basic client server application in delphi indy 10 ;
I have set sever app with local ip and a specific port, and i set client with public
IP to client host when i am testing the application the following error i got
here
I am testing both client and server app in same machine (as i had no other option),will this cause error.
You can absolutely run a TCP client and server on the same computer.
Only one application can listen on a given port at a time, but (virtually) any number of clients can connect to that server, even from the same machine.
Did you find your router settings from the previous question?