Skip to content

Commit ffcabb7

Browse files
committed
Charset implemented for UDPConnector and UDPListener
1 parent e624142 commit ffcabb7

File tree

57 files changed

+1367
-598
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1367
-598
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Sat, 23 Jul 2022 12:03:04 +0300
2+
3+
4+
C\:\\GithubRepositories\\extasys\\Extasys\ for\ Java\ Examples\\Extasys.Examples.TCPClient=
5+
6+
C\:\\GithubRepositories\\extasys\\Extasys\ for\ Java=
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Sat, 23 Jul 2022 12:03:12 +0300
2+
3+
4+
C\:\\GithubRepositories\\extasys\\Extasys\ for\ Java\ Examples\\Extasys.Examples.TCPServer=
5+
6+
C\:\\GithubRepositories\\extasys\\Extasys\ for\ Java=

Extasys for Java Examples/Extasys.Examples.UDPClient/build/built-jar.properties

-6
This file was deleted.

Extasys for Java Examples/Extasys.Examples.UDPClient/dist/README.TXT

-32
This file was deleted.
Binary file not shown.

Extasys for Java Examples/Extasys.Examples.UDPClient/nbproject/build-impl.xml

+548-180
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
build.xml.data.CRC32=b5d09af7
22
build.xml.script.CRC32=b5c2b7b4
3-
build.xml.stylesheet.CRC32=8064a381@1.68.1.46
3+
build.xml.stylesheet.CRC32=f85dc8f2@1.103.0.48
44
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
55
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
66
nbproject/build-impl.xml.data.CRC32=b5d09af7
7-
nbproject/build-impl.xml.script.CRC32=f1c7528c
8-
nbproject/build-impl.xml.stylesheet.CRC32=5a01deb7@1.68.1.46
7+
nbproject/build-impl.xml.script.CRC32=9e623be4
8+
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.103.0.48
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
compile.on.save=false
22
do.depend=false
33
do.jar=true
4+
do.jlink=false
45
javac.debug=true
56
javadoc.preview=true
6-
user.properties.file=C:\\Users\\NSi\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
7+
jlink.strip=false
8+
user.properties.file=C:\\Users\\nsiat\\AppData\\Roaming\\NetBeans\\14\\build.properties

Extasys for Java Examples/Extasys.Examples.UDPClient/nbproject/project.properties

+18-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ build.test.classes.dir=${build.dir}/test/classes
1616
build.test.results.dir=${build.dir}/test/results
1717
debug.classpath=\
1818
${run.classpath}
19+
debug.modulepath=\
20+
${run.modulepath}
1921
debug.test.classpath=\
2022
${run.test.classpath}
23+
debug.test.modulepath=\
24+
${run.test.modulepath}
2125
# This directory is removed when the project is cleaned:
2226
dist.dir=dist
2327
dist.jar=${dist.dir}/Extasys.Examples.UDPClient.jar
@@ -31,16 +35,22 @@ javac.classpath=\
3135
# Space-separated list of extra javac options
3236
javac.compilerargs=
3337
javac.deprecation=false
38+
javac.external.vm=false
39+
javac.modulepath=
40+
javac.processormodulepath=
3441
javac.processorpath=\
3542
${javac.classpath}
36-
javac.source=1.6
37-
javac.target=1.6
43+
javac.source=1.8
44+
javac.target=1.8
3845
javac.test.classpath=\
3946
${javac.classpath}:\
4047
${build.classes.dir}
48+
javac.test.modulepath=\
49+
${javac.modulepath}
4150
javadoc.additionalparam=
4251
javadoc.author=false
4352
javadoc.encoding=${source.encoding}
53+
javadoc.html5=false
4454
javadoc.noindex=false
4555
javadoc.nonavbar=false
4656
javadoc.notree=false
@@ -49,6 +59,8 @@ javadoc.splitindex=true
4959
javadoc.use=true
5060
javadoc.version=false
5161
javadoc.windowtitle=
62+
jlink.launcher=false
63+
jlink.launcher.name=Extasys.Examples.UDPClient
5264
jnlp.codebase.type=local
5365
jnlp.codebase.url=file:/D:/Extasys.Examples.UDPClient/dist/
5466
jnlp.enabled=false
@@ -68,9 +80,13 @@ run.classpath=\
6880
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
6981
# or test-sys-prop.name=value to set system properties for unit tests):
7082
run.jvmargs=
83+
run.modulepath=\
84+
${javac.modulepath}
7185
run.test.classpath=\
7286
${javac.test.classpath}:\
7387
${build.test.classes.dir}
88+
run.test.modulepath=\
89+
${javac.test.modulepath}
7490
source.encoding=UTF-8
7591
src.dir=src
7692
test.src.dir=test

Extasys for Java Examples/Extasys.Examples.UDPClient/src/Extasys/Examples/UDPClient/UDPClient.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ of this software and associated documentation files (the "Software"), to deal
2222
import Extasys.Network.UDP.Client.Connectors.UDPConnector;
2323
import java.net.DatagramPacket;
2424
import java.net.InetAddress;
25+
import java.nio.charset.Charset;
2526

2627
/**
2728
*
@@ -38,13 +39,13 @@ public UDPClient(String name, String description, int readTimeOut, int corePoolS
3839

3940
// Add a UDP connector to this UDP client.
4041
// You can add more than one connectors if you need to.
41-
super.AddConnector("My connector", 10240, 10000, remoteHostIP, remoteHostPort);
42+
super.AddConnector("My connector", 10240, 10000, remoteHostIP, remoteHostPort, Charset.forName("UTF-8"));
4243
}
4344

4445
@Override
4546
public void OnDataReceive(UDPConnector connector, DatagramPacket packet)
4647
{
47-
System.out.println("Data received: " + new String(packet.getData()));
48+
//System.out.println("Data received: " + new String(packet.getData()));
4849
}
4950

5051
public void StartSendingMessages()
@@ -67,7 +68,7 @@ public void StopSendingMessages()
6768
class AutoSendMessages extends Thread
6869
{
6970

70-
private UDPClient fMyClient;
71+
private final UDPClient fMyClient;
7172
private boolean fActive = true;
7273

7374
public AutoSendMessages(UDPClient client)

Extasys for Java Examples/Extasys.Examples.UDPClient/src/Extasys/Examples/UDPClient/frmUDPClient.form

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
</Properties>
99
<SyntheticProperties>
1010
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
11+
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
1112
</SyntheticProperties>
1213
<AuxValues>
1314
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
@@ -60,15 +61,15 @@
6061
<Component id="jLabel12" alignment="0" min="-2" max="-2" attributes="0"/>
6162
<Component id="jLabel13" alignment="0" min="-2" max="-2" attributes="0"/>
6263
</Group>
63-
<EmptySpace pref="283" max="32767" attributes="0"/>
64+
<EmptySpace pref="280" max="32767" attributes="0"/>
6465
<Group type="103" groupAlignment="0" attributes="0">
6566
<Component id="jLabelBytesIn" alignment="0" min="-2" max="-2" attributes="0"/>
6667
<Component id="jLabelBytesOut" alignment="0" min="-2" max="-2" attributes="0"/>
6768
</Group>
6869
</Group>
6970
<Component id="jLabel6" alignment="0" min="-2" pref="111" max="-2" attributes="0"/>
7071
</Group>
71-
<EmptySpace max="-2" attributes="0"/>
72+
<EmptySpace min="-2" pref="15" max="-2" attributes="0"/>
7273
</Group>
7374
</Group>
7475
</DimensionLayout>

Extasys for Java Examples/Extasys.Examples.UDPClient/src/Extasys/Examples/UDPClient/frmUDPClient.java

+39-32
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ of this software and associated documentation files (the "Software"), to deal
2323

2424
/**
2525
*
26-
* @author Nikos Siatras
26+
* @author Nikos Siatras
2727
*/
2828
public class frmUDPClient extends javax.swing.JFrame
2929
{
@@ -39,7 +39,8 @@ public frmUDPClient()
3939

4040
@SuppressWarnings("unchecked")
4141
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
42-
private void initComponents() {
42+
private void initComponents()
43+
{
4344

4445
jLabel6 = new javax.swing.JLabel();
4546
jLabel7 = new javax.swing.JLabel();
@@ -63,66 +64,70 @@ private void initComponents() {
6364
setTitle("Extasys Example UDP Client");
6465
setResizable(false);
6566

66-
jLabel6.setFont(new java.awt.Font("Tahoma", 1, 14));
67+
jLabel6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
6768
jLabel6.setText("UDP Client");
6869

69-
jLabel7.setFont(new java.awt.Font("Tahoma", 0, 10));
70+
jLabel7.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
7071
jLabel7.setText("Remote host IP:");
7172

72-
jLabel8.setFont(new java.awt.Font("Tahoma", 0, 10));
73+
jLabel8.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
7374
jLabel8.setText("Remote Host Port:");
7475

75-
jLabel9.setFont(new java.awt.Font("Tahoma", 0, 10));
76+
jLabel9.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
7677
jLabel9.setText("Core Pool Size:");
7778

78-
jLabel10.setFont(new java.awt.Font("Tahoma", 0, 10));
79+
jLabel10.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
7980
jLabel10.setText("Max. Pool Size:");
8081

81-
jTextFieldRemoteHostPort.setFont(new java.awt.Font("Tahoma", 0, 10));
82+
jTextFieldRemoteHostPort.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
8283
jTextFieldRemoteHostPort.setText("5000");
8384

8485
jTextFieldRemoteHostIP.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
8586
jTextFieldRemoteHostIP.setText("127.0.0.1");
8687

87-
jTextFieldMaxPoolSize.setFont(new java.awt.Font("Tahoma", 0, 10));
88+
jTextFieldMaxPoolSize.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
8889
jTextFieldMaxPoolSize.setText("16");
8990

90-
jTextFieldCorePoolSize.setFont(new java.awt.Font("Tahoma", 0, 10));
91+
jTextFieldCorePoolSize.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
9192
jTextFieldCorePoolSize.setText("8");
9293

93-
jLabel11.setFont(new java.awt.Font("Tahoma", 0, 10));
94+
jLabel11.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
9495
jLabel11.setText("Read Time-Out:");
9596

96-
jTextFieldReadTimeOut.setFont(new java.awt.Font("Tahoma", 0, 10));
97+
jTextFieldReadTimeOut.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
9798
jTextFieldReadTimeOut.setText("8000");
9899

99-
jButton5.setFont(new java.awt.Font("Tahoma", 0, 10));
100+
jButton5.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
100101
jButton5.setText("Start Sending Messages");
101-
jButton5.addActionListener(new java.awt.event.ActionListener() {
102-
public void actionPerformed(java.awt.event.ActionEvent evt) {
102+
jButton5.addActionListener(new java.awt.event.ActionListener()
103+
{
104+
public void actionPerformed(java.awt.event.ActionEvent evt)
105+
{
103106
jButton5ActionPerformed(evt);
104107
}
105108
});
106109

107-
jButton6.setFont(new java.awt.Font("Tahoma", 0, 10));
110+
jButton6.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
108111
jButton6.setText("Stop Sending Messages");
109112
jButton6.setEnabled(false);
110-
jButton6.addActionListener(new java.awt.event.ActionListener() {
111-
public void actionPerformed(java.awt.event.ActionEvent evt) {
113+
jButton6.addActionListener(new java.awt.event.ActionListener()
114+
{
115+
public void actionPerformed(java.awt.event.ActionEvent evt)
116+
{
112117
jButton6ActionPerformed(evt);
113118
}
114119
});
115120

116-
jLabel12.setFont(new java.awt.Font("Tahoma", 0, 10));
121+
jLabel12.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
117122
jLabel12.setText("Bytes Out:");
118123

119-
jLabel13.setFont(new java.awt.Font("Tahoma", 0, 10));
124+
jLabel13.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
120125
jLabel13.setText("Bytes In:");
121126

122-
jLabelBytesIn.setFont(new java.awt.Font("Tahoma", 0, 10));
127+
jLabelBytesIn.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
123128
jLabelBytesIn.setText("0");
124129

125-
jLabelBytesOut.setFont(new java.awt.Font("Tahoma", 0, 10));
130+
jLabelBytesOut.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
126131
jLabelBytesOut.setText("0");
127132

128133
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
@@ -152,18 +157,17 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
152157
.addGroup(layout.createSequentialGroup()
153158
.addComponent(jButton5)
154159
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
155-
.addComponent(jButton6)
156-
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))))
160+
.addComponent(jButton6))))
157161
.addGroup(layout.createSequentialGroup()
158162
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
159163
.addComponent(jLabel12)
160164
.addComponent(jLabel13))
161-
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 283, Short.MAX_VALUE)
165+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 280, Short.MAX_VALUE)
162166
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
163167
.addComponent(jLabelBytesIn)
164168
.addComponent(jLabelBytesOut)))
165169
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))
166-
.addContainerGap())
170+
.addGap(15, 15, 15))
167171
);
168172
layout.setVerticalGroup(
169173
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -217,14 +221,14 @@ private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
217221
fUDPClient = new UDPClient("My UDP client", "Example", Integer.parseInt(jTextFieldReadTimeOut.getText()), Integer.parseInt(jTextFieldCorePoolSize.getText()),
218222
Integer.parseInt(jTextFieldMaxPoolSize.getText()), InetAddress.getByName(jTextFieldRemoteHostIP.getText()), Integer.parseInt(jTextFieldRemoteHostPort.getText()));
219223
fUDPClient.Start();
220-
224+
221225
fUpdateStatusActive = true;
222226

223227
fUDPClient.StartSendingMessages();
224228

225229
fUpdateStatusThread = new Thread(new Runnable()
226230
{
227-
231+
@Override
228232
public void run()
229233
{
230234
try
@@ -236,7 +240,7 @@ public void run()
236240
jLabelBytesIn.setText(String.valueOf(fUDPClient.getBytesIn()));
237241
jLabelBytesOut.setText(String.valueOf(fUDPClient.getBytesOut()));
238242
}
239-
Thread.sleep(1);
243+
Thread.sleep(100);
240244
}
241245
}
242246
catch (Exception ex)
@@ -275,9 +279,12 @@ private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
275279
}
276280
}//GEN-LAST:event_jButton6ActionPerformed
277281

278-
public static void main(String args[]) {
279-
java.awt.EventQueue.invokeLater(new Runnable() {
280-
public void run() {
282+
public static void main(String args[])
283+
{
284+
java.awt.EventQueue.invokeLater(new Runnable()
285+
{
286+
public void run()
287+
{
281288
new frmUDPClient().setVisible(true);
282289
}
283290
});

Extasys for Java Examples/Extasys.Examples.UDPServer/build/built-jar.properties

-6
This file was deleted.

0 commit comments

Comments
 (0)