https://github.com/compscidr/libdetect
Performs detection of open TCP ports on the local networks that a particular device is connected to.
https://github.com/compscidr/libdetect
Last synced: about 1 year ago
JSON representation
Performs detection of open TCP ports on the local networks that a particular device is connected to.
- Host: GitHub
- URL: https://github.com/compscidr/libdetect
- Owner: compscidr
- License: apache-2.0
- Created: 2018-10-17T01:17:38.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2025-04-14T18:32:23.000Z (about 1 year ago)
- Last Synced: 2025-04-23T19:29:43.352Z (about 1 year ago)
- Language: Java
- Size: 563 KB
- Stars: 1
- Watchers: 1
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# libdetect
[](https://jitpack.io/#compscidr/libdetect)
Performs detection of open TCP ports on the local networks that a particular device is connected to.
You can use this library
in your project with gradle using jitpack:
```java
repositories {
maven { url 'https://jitpack.io' }
}
```
```java
dependencies {
implementation 'com.github.compscidr:libdetect:v1.0'
}
```
# Features
* Can monitor multiple TCP ports with subsequent calls to start(port) function.
* Supports callbacks for the following two events:
* PeerReachable events generated when a peer becomes reachable on the local network with the specified TCP port.
* PeerUnreachable events generated when a previously reachable peer is no longer reachable with the specified TCP port.
## Register for TCP peer discovery:
For example let's suppose we wish to have events generated for any port 80 tcp servers running on all local networks:
```
LibDetect test = new LibDetect();
test.start(80, new ActionListener() {
@Override
public void onPeerReachable(PeerReachable peer) {
System.out.println("PEER REACHABLE on " + peer.address.getHostAddress() + " port: " + 80);
}
@Override
public void onPeerUnreachable(PeerUnreachable peer) {
System.out.println("PEER UNREACHABLE on " + peer.address.getHostAddress() + " port: " + 80);
}
}, false);
```
## Cleanup (stop listening for peer discovery events)
```
test.stop(80);
```