I am developing a C / S program using Delphi 7, TServerSocket, and TClientSocket controls. One problem is that I can only use my PC as a server, and my PC is using virtual dialer, so the ISP keeps changing my IP once or twice a day.
Because I open a router, serversecet directly in my local IP (192.168.1.x), just mapped to my public IP, so I do not think server server should crash itself When my public IP changes I think what should be: When my IP changes, all the connecting socket becomes unavailable, and when my app does not know it and still use the socket So am, ServerSocket should receive "OnClientError" Some event.
But I got a strange problem - when my IP changed, the server application stopped automatically. I do not know what really happened because the shutdown time is noon, I was in my office, but I saw one more result: Even I used heartbeat in my application layer protocol, server Ever failed to catch the living failure - because I have entered everything in a log file on my server, and I can not find it. So my IR changed when my server should be closed immediately, which could not even reach the living argument.
It seems very odd, how to close the entire application directly to a fault error (due to IP change)? Please, if any explanation and thanks for dealing with this problem, please
Once the socket has been opened, Its bound to IP address will never change. It can not be 'fixed' on the server side I recommend working on the stability of the server, customers should also know that the server is no longer present on the given IP address, and reconnect. (It is free why the server is unavailable - a resume server is normal.)
No comments:
Post a Comment