delphi - How to check if a socket client-server is on same network? -


I am working with socket and on this I am using TIdTCPClient and TIdTCPServer. I need to check whether the TIdTCPServer TIdTCP client connects on the same network.

How can I do this?

You need to know the customer's subnet mask like that Comparison sockets do not expose that information, so you have to ask the OS directly (for example, on Windows, you can connect client's connected local IP to GetAdaptersInfo () or GetAdapterAddresses () < / Code>). After you have a mask, you can mask the IP of the client and the server's IP with it and see if the resulting values ​​are the same or not.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -