开发者

How do I find out the IP addresses of PCs that access my Ubuntu machine's WLAN interface, using Java code?

I would like to limit resource access to only 1 client at a time.

If a 2nd unique client tries to access my PC (which is acting as a server) then it should not be allowed, until the previous client is done with its work (or for a specified time).

By tracking IP addresses开发者_如何学JAVA that are accessing my resource, I would like to block/unblock clients from accessing or transferring data.

Is there any way to develop a Java application that will call the Linux networking APIs in order to get details of these events, including the IP address of the client?


Via a command line, you can see remote IP's accessing each of your interfaces using netstat -unt. However, for your application, you are probably better off maintaining a list of connected clients in a shared database. Be sure to track when the connection was made or last transmitted data so you can expire stale data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜