Skip to content

Commit 1dcae82

Browse files
committed
Implements the active() method for Serial and Server (Issue processing#2364).
1 parent 4e6cbff commit 1dcae82

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
@@ -176,6 +176,13 @@ protected int clientIndex(Client client) {
176176
return -1;
177177
}
178178

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

180187
static public String ip() {
181188
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)