muneeb ifkaar wrote:Hello. i want to know that how can we know the ip address of client on server side in socket (java). i.e suppose there is a server "S" and 2 clients "A" and "B". Client A send me(server) some info, and Client B send me(server) some other info. i have to store that info coming from A and B in Db in different tables. How can i Differentiate between client A and B request.
Assuming that you are using TCP, your "server", which is using a ServerSocket should return different Socket objects for each client, and hence, should be easy for you to differentiate the two clients.
However, to answer you question -- with the data Socket object, you can get the InetAddress object, which can be used to get the IP address. A
word of warning though, this address may be incorrect if the clients are going through a firewall or router that is going through network address translation.
Henry