propane 3.10.0-java → 3.11.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.mvn/wrapper/maven-wrapper.properties +1 -1
- data/CHANGELOG.md +2 -0
- data/README.md +7 -7
- data/lib/propane/app.rb +2 -5
- data/lib/propane/helper_methods.rb +6 -6
- data/lib/propane/version.rb +1 -1
- data/lib/{propane-3.10.0.jar → propane-3.11.0.jar} +0 -0
- data/pom.rb +6 -6
- data/pom.xml +6 -6
- data/propane.gemspec +3 -3
- data/src/main/java/monkstone/noise/OpenSimplex2F.java +838 -737
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +8 -13
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +14 -28
- data/src/main/java/processing/awt/PImageAWT.java +6 -4
- data/src/main/java/processing/core/PApplet.java +71 -59
- data/src/main/java/processing/core/PImage.java +14 -14
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +13 -13
- data/src/main/java/processing/opengl/PShader.java +1 -6
- data/src/main/java/processing/opengl/PSurfaceJOGL.java +6 -6
- data/{lib/java/processing/opengl → src/main/resources}/cursors/arrow.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/cross.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/hand.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/license.txt +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/move.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/text.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/wait.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/ColorFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/ColorVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LightFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LightVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LineFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LineVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/MaskFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/PointFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/PointVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexLightFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexLightVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexVert.glsl +0 -0
- data/test/test_helper.rb +1 -0
- data/vendors/Rakefile +1 -1
- metadata +29 -155
- data/lib/java/japplemenubar/JAppleMenuBar.java +0 -88
- data/lib/java/japplemenubar/libjAppleMenuBar.jnilib +0 -0
- data/lib/java/monkstone/ColorUtil.java +0 -127
- data/lib/java/monkstone/MathToolModule.java +0 -287
- data/lib/java/monkstone/PropaneLibrary.java +0 -46
- data/lib/java/monkstone/core/LibraryProxy.java +0 -136
- data/lib/java/monkstone/fastmath/DegLutTables.java +0 -111
- data/lib/java/monkstone/fastmath/Deglut.java +0 -71
- data/lib/java/monkstone/fastmath/package-info.java +0 -6
- data/lib/java/monkstone/filechooser/Chooser.java +0 -39
- data/lib/java/monkstone/noise/FastTerrain.java +0 -874
- data/lib/java/monkstone/noise/Noise.java +0 -90
- data/lib/java/monkstone/noise/NoiseGenerator.java +0 -75
- data/lib/java/monkstone/noise/NoiseMode.java +0 -28
- data/lib/java/monkstone/noise/OpenSimplex2F.java +0 -881
- data/lib/java/monkstone/noise/OpenSimplex2S.java +0 -1106
- data/lib/java/monkstone/noise/SmoothTerrain.java +0 -1099
- data/lib/java/monkstone/slider/CustomHorizontalSlider.java +0 -164
- data/lib/java/monkstone/slider/CustomVerticalSlider.java +0 -178
- data/lib/java/monkstone/slider/SimpleHorizontalSlider.java +0 -145
- data/lib/java/monkstone/slider/SimpleSlider.java +0 -166
- data/lib/java/monkstone/slider/SimpleVerticalSlider.java +0 -157
- data/lib/java/monkstone/slider/Slider.java +0 -61
- data/lib/java/monkstone/slider/SliderBar.java +0 -245
- data/lib/java/monkstone/slider/SliderGroup.java +0 -56
- data/lib/java/monkstone/slider/WheelHandler.java +0 -35
- data/lib/java/monkstone/vecmath/GfxRender.java +0 -86
- data/lib/java/monkstone/vecmath/JRender.java +0 -56
- data/lib/java/monkstone/vecmath/ShapeRender.java +0 -87
- data/lib/java/monkstone/vecmath/package-info.java +0 -20
- data/lib/java/monkstone/vecmath/vec2/Vec2.java +0 -802
- data/lib/java/monkstone/vecmath/vec2/package-info.java +0 -6
- data/lib/java/monkstone/vecmath/vec3/Vec3.java +0 -727
- data/lib/java/monkstone/vecmath/vec3/package-info.java +0 -6
- data/lib/java/monkstone/videoevent/CaptureEvent.java +0 -27
- data/lib/java/monkstone/videoevent/MovieEvent.java +0 -32
- data/lib/java/monkstone/videoevent/package-info.java +0 -20
- data/lib/java/processing/awt/PGraphicsJava2D.java +0 -3040
- data/lib/java/processing/awt/PImageAWT.java +0 -377
- data/lib/java/processing/awt/PShapeJava2D.java +0 -387
- data/lib/java/processing/awt/PSurfaceAWT.java +0 -1581
- data/lib/java/processing/awt/ShimAWT.java +0 -581
- data/lib/java/processing/core/PApplet.java +0 -15156
- data/lib/java/processing/core/PConstants.java +0 -523
- data/lib/java/processing/core/PFont.java +0 -1126
- data/lib/java/processing/core/PGraphics.java +0 -8600
- data/lib/java/processing/core/PImage.java +0 -3377
- data/lib/java/processing/core/PMatrix.java +0 -208
- data/lib/java/processing/core/PMatrix2D.java +0 -562
- data/lib/java/processing/core/PMatrix3D.java +0 -890
- data/lib/java/processing/core/PShape.java +0 -3561
- data/lib/java/processing/core/PShapeOBJ.java +0 -483
- data/lib/java/processing/core/PShapeSVG.java +0 -2016
- data/lib/java/processing/core/PStyle.java +0 -63
- data/lib/java/processing/core/PSurface.java +0 -198
- data/lib/java/processing/core/PSurfaceNone.java +0 -431
- data/lib/java/processing/core/PVector.java +0 -1066
- data/lib/java/processing/core/ThinkDifferent.java +0 -115
- data/lib/java/processing/data/DoubleDict.java +0 -850
- data/lib/java/processing/data/DoubleList.java +0 -928
- data/lib/java/processing/data/FloatDict.java +0 -847
- data/lib/java/processing/data/FloatList.java +0 -936
- data/lib/java/processing/data/IntDict.java +0 -807
- data/lib/java/processing/data/IntList.java +0 -936
- data/lib/java/processing/data/JSONArray.java +0 -1260
- data/lib/java/processing/data/JSONObject.java +0 -2282
- data/lib/java/processing/data/JSONTokener.java +0 -435
- data/lib/java/processing/data/LongDict.java +0 -802
- data/lib/java/processing/data/LongList.java +0 -937
- data/lib/java/processing/data/Sort.java +0 -46
- data/lib/java/processing/data/StringDict.java +0 -613
- data/lib/java/processing/data/StringList.java +0 -800
- data/lib/java/processing/data/Table.java +0 -4936
- data/lib/java/processing/data/TableRow.java +0 -198
- data/lib/java/processing/data/XML.java +0 -1156
- data/lib/java/processing/dxf/RawDXF.java +0 -404
- data/lib/java/processing/event/Event.java +0 -125
- data/lib/java/processing/event/KeyEvent.java +0 -70
- data/lib/java/processing/event/MouseEvent.java +0 -114
- data/lib/java/processing/event/TouchEvent.java +0 -57
- data/lib/java/processing/javafx/PGraphicsFX2D.java +0 -32
- data/lib/java/processing/javafx/PSurfaceFX.java +0 -173
- data/lib/java/processing/net/Client.java +0 -744
- data/lib/java/processing/net/Server.java +0 -388
- data/lib/java/processing/opengl/FontTexture.java +0 -378
- data/lib/java/processing/opengl/FrameBuffer.java +0 -513
- data/lib/java/processing/opengl/LinePath.java +0 -627
- data/lib/java/processing/opengl/LineStroker.java +0 -681
- data/lib/java/processing/opengl/PGL.java +0 -3483
- data/lib/java/processing/opengl/PGraphics2D.java +0 -615
- data/lib/java/processing/opengl/PGraphics3D.java +0 -281
- data/lib/java/processing/opengl/PGraphicsOpenGL.java +0 -13753
- data/lib/java/processing/opengl/PJOGL.java +0 -2008
- data/lib/java/processing/opengl/PShader.java +0 -1484
- data/lib/java/processing/opengl/PShapeOpenGL.java +0 -5269
- data/lib/java/processing/opengl/PSurfaceJOGL.java +0 -1385
- data/lib/java/processing/opengl/Texture.java +0 -1696
- data/lib/java/processing/opengl/VertexBuffer.java +0 -88
- data/lib/java/processing/pdf/PGraphicsPDF.java +0 -581
- data/lib/java/processing/svg/PGraphicsSVG.java +0 -378
- data/src/main/java/processing/opengl/cursors/arrow.png +0 -0
- data/src/main/java/processing/opengl/cursors/cross.png +0 -0
- data/src/main/java/processing/opengl/cursors/hand.png +0 -0
- data/src/main/java/processing/opengl/cursors/license.txt +0 -27
- data/src/main/java/processing/opengl/cursors/move.png +0 -0
- data/src/main/java/processing/opengl/cursors/text.png +0 -0
- data/src/main/java/processing/opengl/cursors/wait.png +0 -0
- data/src/main/java/processing/opengl/shaders/ColorFrag.glsl +0 -32
- data/src/main/java/processing/opengl/shaders/ColorVert.glsl +0 -34
- data/src/main/java/processing/opengl/shaders/LightFrag.glsl +0 -33
- data/src/main/java/processing/opengl/shaders/LightVert.glsl +0 -151
- data/src/main/java/processing/opengl/shaders/LineFrag.glsl +0 -32
- data/src/main/java/processing/opengl/shaders/LineVert.glsl +0 -100
- data/src/main/java/processing/opengl/shaders/MaskFrag.glsl +0 -40
- data/src/main/java/processing/opengl/shaders/PointFrag.glsl +0 -32
- data/src/main/java/processing/opengl/shaders/PointVert.glsl +0 -56
- data/src/main/java/processing/opengl/shaders/TexFrag.glsl +0 -37
- data/src/main/java/processing/opengl/shaders/TexLightFrag.glsl +0 -37
- data/src/main/java/processing/opengl/shaders/TexLightVert.glsl +0 -157
- data/src/main/java/processing/opengl/shaders/TexVert.glsl +0 -38
@@ -1,388 +0,0 @@
|
|
1
|
-
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
/*
|
4
|
-
Server - basic network server implementation
|
5
|
-
Part of the Processing project - http://processing.org
|
6
|
-
|
7
|
-
Copyright (c) 2004-2007 Ben Fry and Casey Reas
|
8
|
-
The previous version of this code was developed by Hernando Barragan
|
9
|
-
|
10
|
-
This library is free software; you can redistribute it and/or
|
11
|
-
modify it under the terms of the GNU Lesser General Public
|
12
|
-
License as published by the Free Software Foundation; either
|
13
|
-
version 2.1 of the License, or (at your option) any later version.
|
14
|
-
|
15
|
-
This library is distributed in the hope that it will be useful,
|
16
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
18
|
-
Lesser General Public License for more details.
|
19
|
-
|
20
|
-
You should have received a copy of the GNU Lesser General
|
21
|
-
Public License along with this library; if not, write to the
|
22
|
-
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
23
|
-
Boston, MA 02111-1307 USA
|
24
|
-
*/
|
25
|
-
|
26
|
-
package processing.net;
|
27
|
-
|
28
|
-
import processing.core.*;
|
29
|
-
|
30
|
-
import java.io.*;
|
31
|
-
import java.lang.reflect.*;
|
32
|
-
import java.net.*;
|
33
|
-
|
34
|
-
|
35
|
-
/**
|
36
|
-
* ( begin auto-generated from Server.xml )
|
37
|
-
*
|
38
|
-
* A server sends and receives data to and from its associated clients
|
39
|
-
* (other programs connected to it). When a server is started, it begins
|
40
|
-
* listening for connections on the port specified by the <b>port</b>
|
41
|
-
* parameter. Computers have many ports for transferring data and some are
|
42
|
-
* commonly used so be sure to not select one of these. For example, web
|
43
|
-
* servers usually use port 80 and POP mail uses port 110.
|
44
|
-
*
|
45
|
-
*
|
46
|
-
* @webref net
|
47
|
-
* @usage application
|
48
|
-
* @brief The server class is used to create server objects which send and receives data to and from its associated clients (other programs connected to it).
|
49
|
-
* @instanceName server any variable of type Server
|
50
|
-
*/
|
51
|
-
public class Server implements Runnable {
|
52
|
-
PApplet parent;
|
53
|
-
Method serverEventMethod;
|
54
|
-
|
55
|
-
volatile Thread thread;
|
56
|
-
ServerSocket server;
|
57
|
-
int port;
|
58
|
-
|
59
|
-
protected final Object clientsLock = new Object[0];
|
60
|
-
/** Number of clients currently connected. */
|
61
|
-
public int clientCount;
|
62
|
-
/** Array of client objects, useful length is determined by clientCount. */
|
63
|
-
public Client[] clients;
|
64
|
-
|
65
|
-
|
66
|
-
/**
|
67
|
-
* @param parent typically use "this"
|
68
|
-
* @param port port used to transfer data
|
69
|
-
*/
|
70
|
-
public Server(PApplet parent, int port) {
|
71
|
-
this(parent, port, null);
|
72
|
-
}
|
73
|
-
|
74
|
-
|
75
|
-
/**
|
76
|
-
* @param parent typically use "this"
|
77
|
-
* @param port port used to transfer data
|
78
|
-
* @param host when multiple NICs are in use, the ip (or name) to bind from
|
79
|
-
*/
|
80
|
-
public Server(PApplet parent, int port, String host) {
|
81
|
-
this.parent = parent;
|
82
|
-
this.port = port;
|
83
|
-
|
84
|
-
try {
|
85
|
-
if (host == null) {
|
86
|
-
server = new ServerSocket(this.port);
|
87
|
-
} else {
|
88
|
-
server = new ServerSocket(this.port, 10, InetAddress.getByName(host));
|
89
|
-
}
|
90
|
-
//clients = new Vector();
|
91
|
-
clients = new Client[10];
|
92
|
-
|
93
|
-
thread = new Thread(this);
|
94
|
-
thread.start();
|
95
|
-
|
96
|
-
parent.registerMethod("dispose", this);
|
97
|
-
|
98
|
-
// reflection to check whether host applet has a call for
|
99
|
-
// public void serverEvent(Server s, Client c);
|
100
|
-
// which is called when a new guy connects
|
101
|
-
try {
|
102
|
-
serverEventMethod =
|
103
|
-
parent.getClass().getMethod("serverEvent", Server.class, Client.class);
|
104
|
-
} catch (Exception e) {
|
105
|
-
// no such method, or an error.. which is fine, just ignore
|
106
|
-
}
|
107
|
-
|
108
|
-
} catch (IOException e) {
|
109
|
-
//e.printStackTrace();
|
110
|
-
thread = null;
|
111
|
-
throw new RuntimeException(e);
|
112
|
-
//errorMessage("<init>", e);
|
113
|
-
}
|
114
|
-
}
|
115
|
-
|
116
|
-
|
117
|
-
/**
|
118
|
-
* ( begin auto-generated from Server_disconnect.xml )
|
119
|
-
*
|
120
|
-
* Disconnect a particular client.
|
121
|
-
*
|
122
|
-
*
|
123
|
-
* @brief Disconnect a particular client.
|
124
|
-
* @webref server:server
|
125
|
-
* @param client the client to disconnect
|
126
|
-
*/
|
127
|
-
public void disconnect(Client client) {
|
128
|
-
client.stop();
|
129
|
-
synchronized (clientsLock) {
|
130
|
-
int index = clientIndex(client);
|
131
|
-
if (index != -1) {
|
132
|
-
removeIndex(index);
|
133
|
-
}
|
134
|
-
}
|
135
|
-
}
|
136
|
-
|
137
|
-
|
138
|
-
protected void removeIndex(int index) {
|
139
|
-
synchronized (clientsLock) {
|
140
|
-
clientCount--;
|
141
|
-
// shift down the remaining clients
|
142
|
-
for (int i = index; i < clientCount; i++) {
|
143
|
-
clients[i] = clients[i + 1];
|
144
|
-
}
|
145
|
-
// mark last empty var for garbage collection
|
146
|
-
clients[clientCount] = null;
|
147
|
-
}
|
148
|
-
}
|
149
|
-
|
150
|
-
|
151
|
-
protected void disconnectAll() {
|
152
|
-
synchronized (clientsLock) {
|
153
|
-
for (int i = 0; i < clientCount; i++) {
|
154
|
-
try {
|
155
|
-
clients[i].stop();
|
156
|
-
} catch (Exception e) {
|
157
|
-
// ignore
|
158
|
-
}
|
159
|
-
clients[i] = null;
|
160
|
-
}
|
161
|
-
clientCount = 0;
|
162
|
-
}
|
163
|
-
}
|
164
|
-
|
165
|
-
|
166
|
-
protected void addClient(Client client) {
|
167
|
-
synchronized (clientsLock) {
|
168
|
-
if (clientCount == clients.length) {
|
169
|
-
clients = (Client[]) PApplet.expand(clients);
|
170
|
-
}
|
171
|
-
clients[clientCount++] = client;
|
172
|
-
}
|
173
|
-
}
|
174
|
-
|
175
|
-
|
176
|
-
protected int clientIndex(Client client) {
|
177
|
-
synchronized (clientsLock) {
|
178
|
-
for (int i = 0; i < clientCount; i++) {
|
179
|
-
if (clients[i] == client) {
|
180
|
-
return i;
|
181
|
-
}
|
182
|
-
}
|
183
|
-
return -1;
|
184
|
-
}
|
185
|
-
}
|
186
|
-
|
187
|
-
|
188
|
-
/**
|
189
|
-
* ( begin auto-generated from Server_active.xml )
|
190
|
-
*
|
191
|
-
* Returns true if this server is still active and hasn't run
|
192
|
-
* into any trouble.
|
193
|
-
*
|
194
|
-
*
|
195
|
-
* @webref server:server
|
196
|
-
* @brief Return true if this server is still active.
|
197
|
-
*/
|
198
|
-
public boolean active() {
|
199
|
-
return thread != null;
|
200
|
-
}
|
201
|
-
|
202
|
-
|
203
|
-
static public String ip() {
|
204
|
-
try {
|
205
|
-
return InetAddress.getLocalHost().getHostAddress();
|
206
|
-
} catch (UnknownHostException e) {
|
207
|
-
|
208
|
-
return null;
|
209
|
-
}
|
210
|
-
}
|
211
|
-
|
212
|
-
|
213
|
-
// the last index used for available. can't just cycle through
|
214
|
-
// the clients in order from 0 each time, because if client 0 won't
|
215
|
-
// shut up, then the rest of the clients will never be heard from.
|
216
|
-
int lastAvailable = -1;
|
217
|
-
|
218
|
-
/**
|
219
|
-
* ( begin auto-generated from Server_available.xml )
|
220
|
-
*
|
221
|
-
* Returns the next client in line with a new message.
|
222
|
-
*
|
223
|
-
*
|
224
|
-
* @brief Returns the next client in line with a new message.
|
225
|
-
* @webref server
|
226
|
-
* @usage application
|
227
|
-
*/
|
228
|
-
public Client available() {
|
229
|
-
synchronized (clientsLock) {
|
230
|
-
int index = lastAvailable + 1;
|
231
|
-
if (index >= clientCount) index = 0;
|
232
|
-
|
233
|
-
for (int i = 0; i < clientCount; i++) {
|
234
|
-
int which = (index + i) % clientCount;
|
235
|
-
Client client = clients[which];
|
236
|
-
//Check for valid client
|
237
|
-
if (!client.active()){
|
238
|
-
removeIndex(which); //Remove dead client
|
239
|
-
i--; //Don't skip the next client
|
240
|
-
//If the client has data make sure lastAvailable
|
241
|
-
//doesn't end up skipping the next client
|
242
|
-
which--;
|
243
|
-
//fall through to allow data from dead clients
|
244
|
-
//to be retreived.
|
245
|
-
}
|
246
|
-
if (client.available() > 0) {
|
247
|
-
lastAvailable = which;
|
248
|
-
return client;
|
249
|
-
}
|
250
|
-
}
|
251
|
-
}
|
252
|
-
return null;
|
253
|
-
}
|
254
|
-
|
255
|
-
|
256
|
-
/**
|
257
|
-
* ( begin auto-generated from Server_stop.xml )
|
258
|
-
*
|
259
|
-
* Disconnects all clients and stops the server.
|
260
|
-
*
|
261
|
-
*
|
262
|
-
* <h3>Advanced</h3>
|
263
|
-
* Use this to shut down the server if you finish using it while your applet
|
264
|
-
* is still running. Otherwise, it will be automatically be shut down by the
|
265
|
-
* host PApplet using dispose(), which is identical.
|
266
|
-
* @brief Disconnects all clients and stops the server.
|
267
|
-
* @webref server
|
268
|
-
* @usage application
|
269
|
-
*/
|
270
|
-
public void stop() {
|
271
|
-
dispose();
|
272
|
-
}
|
273
|
-
|
274
|
-
|
275
|
-
/**
|
276
|
-
* Disconnect all clients and stop the server: internal use only.
|
277
|
-
*/
|
278
|
-
public void dispose() {
|
279
|
-
thread = null;
|
280
|
-
|
281
|
-
if (clients != null) {
|
282
|
-
disconnectAll();
|
283
|
-
clientCount = 0;
|
284
|
-
clients = null;
|
285
|
-
}
|
286
|
-
|
287
|
-
try {
|
288
|
-
if (server != null) {
|
289
|
-
server.close();
|
290
|
-
server = null;
|
291
|
-
}
|
292
|
-
} catch (IOException e) {
|
293
|
-
|
294
|
-
}
|
295
|
-
}
|
296
|
-
|
297
|
-
|
298
|
-
@Override
|
299
|
-
public void run() {
|
300
|
-
while (Thread.currentThread() == thread) {
|
301
|
-
try {
|
302
|
-
Socket socket = server.accept();
|
303
|
-
Client client = new Client(parent, socket);
|
304
|
-
synchronized (clientsLock) {
|
305
|
-
addClient(client);
|
306
|
-
if (serverEventMethod != null) {
|
307
|
-
try {
|
308
|
-
serverEventMethod.invoke(parent, this, client);
|
309
|
-
} catch (Exception e) {
|
310
|
-
System.err.println("Disabling serverEvent() for port " + port);
|
311
|
-
Throwable cause = e;
|
312
|
-
// unwrap the exception if it came from the user code
|
313
|
-
if (e instanceof InvocationTargetException && e.getCause() != null) {
|
314
|
-
cause = e.getCause();
|
315
|
-
}
|
316
|
-
cause.printStackTrace();
|
317
|
-
serverEventMethod = null;
|
318
|
-
}
|
319
|
-
}
|
320
|
-
}
|
321
|
-
} catch (SocketException e) {
|
322
|
-
//thrown when server.close() is called and server is waiting on accept
|
323
|
-
System.err.println("Server SocketException: " + e.getMessage());
|
324
|
-
thread = null;
|
325
|
-
} catch (IOException e) {
|
326
|
-
//errorMessage("run", e);
|
327
|
-
|
328
|
-
thread = null;
|
329
|
-
}
|
330
|
-
}
|
331
|
-
}
|
332
|
-
|
333
|
-
|
334
|
-
/**
|
335
|
-
* ( begin auto-generated from Server_write.xml )
|
336
|
-
*
|
337
|
-
* Writes a value to all the connected clients. It sends bytes out from the
|
338
|
-
* Server object.
|
339
|
-
*
|
340
|
-
*
|
341
|
-
* @webref server
|
342
|
-
* @brief Writes data to all connected clients
|
343
|
-
* @param data data to write
|
344
|
-
*/
|
345
|
-
public void write(int data) { // will also cover char
|
346
|
-
synchronized (clientsLock) {
|
347
|
-
int index = 0;
|
348
|
-
while (index < clientCount) {
|
349
|
-
if (clients[index].active()) {
|
350
|
-
clients[index].write(data);
|
351
|
-
index++;
|
352
|
-
} else {
|
353
|
-
removeIndex(index);
|
354
|
-
}
|
355
|
-
}
|
356
|
-
}
|
357
|
-
}
|
358
|
-
|
359
|
-
|
360
|
-
public void write(byte data[]) {
|
361
|
-
synchronized (clientsLock) {
|
362
|
-
int index = 0;
|
363
|
-
while (index < clientCount) {
|
364
|
-
if (clients[index].active()) {
|
365
|
-
clients[index].write(data);
|
366
|
-
index++;
|
367
|
-
} else {
|
368
|
-
removeIndex(index);
|
369
|
-
}
|
370
|
-
}
|
371
|
-
}
|
372
|
-
}
|
373
|
-
|
374
|
-
|
375
|
-
public void write(String data) {
|
376
|
-
synchronized (clientsLock) {
|
377
|
-
int index = 0;
|
378
|
-
while (index < clientCount) {
|
379
|
-
if (clients[index].active()) {
|
380
|
-
clients[index].write(data);
|
381
|
-
index++;
|
382
|
-
} else {
|
383
|
-
removeIndex(index);
|
384
|
-
}
|
385
|
-
}
|
386
|
-
}
|
387
|
-
}
|
388
|
-
}
|