Skip to content

Commit ce540be

Browse files
committed
Merge pull request #2588 from kfeuz/Issue2364
Implements the active() method for Serial and Server (Issue #2364).
2 parents 74379a1 + 1dcae82 commit ce540be

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

java/libraries/net/src/processing/net/Server.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ protected int clientIndex(Client client) {
177177
return -1;
178178
}
179179

180+
/**
181+
* Return true if this server is still active and hasn't run
182+
* into any trouble.
183+
*/
184+
public boolean active() {
185+
return (thread != null);
186+
}
180187

181188
static public String ip() {
182189
try {

java/libraries/serial/src/processing/serial/Serial.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,15 @@ public void dispose() {
135135
}
136136

137137

138+
/**
139+
* Return true if this port is still active and hasn't run
140+
* into any trouble.
141+
*/
142+
public boolean active() {
143+
return (port.isOpened());
144+
}
145+
146+
138147
public void pre() {
139148
if (serialAvailableMethod != null && invokeSerialAvailable) {
140149
invokeSerialAvailable = false;

0 commit comments

Comments
 (0)