Skip to content

Commit

Permalink
Charset implemented for UDPConnector and UDPListener
Browse files Browse the repository at this point in the history
  • Loading branch information
nsiatras committed Jul 23, 2022
1 parent e624142 commit ffcabb7
Show file tree
Hide file tree
Showing 57 changed files with 1,367 additions and 598 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Sat, 23 Jul 2022 12:03:04 +0300


C\:\\GithubRepositories\\extasys\\Extasys\ for\ Java\ Examples\\Extasys.Examples.TCPClient=

C\:\\GithubRepositories\\extasys\\Extasys\ for\ Java=
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Sat, 23 Jul 2022 12:03:12 +0300


C\:\\GithubRepositories\\extasys\\Extasys\ for\ Java\ Examples\\Extasys.Examples.TCPServer=

C\:\\GithubRepositories\\extasys\\Extasys\ for\ Java=
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build.xml.data.CRC32=b5d09af7
build.xml.script.CRC32=b5c2b7b4
build.xml.stylesheet.CRC32=8064a381@1.68.1.46
build.xml.stylesheet.CRC32=f85dc8f2@1.103.0.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=b5d09af7
nbproject/build-impl.xml.script.CRC32=f1c7528c
nbproject/build-impl.xml.stylesheet.CRC32=5a01deb7@1.68.1.46
nbproject/build-impl.xml.script.CRC32=9e623be4
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.103.0.48
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
compile.on.save=false
do.depend=false
do.jar=true
do.jlink=false
javac.debug=true
javadoc.preview=true
user.properties.file=C:\\Users\\NSi\\AppData\\Roaming\\NetBeans\\7.4\\build.properties
jlink.strip=false
user.properties.file=C:\\Users\\nsiat\\AppData\\Roaming\\NetBeans\\14\\build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
debug.classpath=\
${run.classpath}
debug.modulepath=\
${run.modulepath}
debug.test.classpath=\
${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/Extasys.Examples.UDPClient.jar
Expand All @@ -31,16 +35,22 @@ javac.classpath=\
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=false
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=1.6
javac.target=1.6
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
Expand All @@ -49,6 +59,8 @@ javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
jlink.launcher=false
jlink.launcher.name=Extasys.Examples.UDPClient
jnlp.codebase.type=local
jnlp.codebase.url=file:/D:/Extasys.Examples.UDPClient/dist/
jnlp.enabled=false
Expand All @@ -68,9 +80,13 @@ run.classpath=\
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=
run.modulepath=\
${javac.modulepath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ of this software and associated documentation files (the "Software"), to deal
import Extasys.Network.UDP.Client.Connectors.UDPConnector;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.nio.charset.Charset;

/**
*
Expand All @@ -38,13 +39,13 @@ public UDPClient(String name, String description, int readTimeOut, int corePoolS

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

@Override
public void OnDataReceive(UDPConnector connector, DatagramPacket packet)
{
System.out.println("Data received: " + new String(packet.getData()));
//System.out.println("Data received: " + new String(packet.getData()));
}

public void StartSendingMessages()
Expand All @@ -67,7 +68,7 @@ public void StopSendingMessages()
class AutoSendMessages extends Thread
{

private UDPClient fMyClient;
private final UDPClient fMyClient;
private boolean fActive = true;

public AutoSendMessages(UDPClient client)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
Expand Down Expand Up @@ -60,15 +61,15 @@
<Component id="jLabel12" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel13" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="283" max="32767" attributes="0"/>
<EmptySpace pref="280" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabelBytesIn" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabelBytesOut" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="jLabel6" alignment="0" min="-2" pref="111" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" pref="15" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ of this software and associated documentation files (the "Software"), to deal

/**
*
* @author Nikos Siatras
* @author Nikos Siatras
*/
public class frmUDPClient extends javax.swing.JFrame
{
Expand All @@ -39,7 +39,8 @@ public frmUDPClient()

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

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

jLabel6.setFont(new java.awt.Font("Tahoma", 1, 14));
jLabel6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel6.setText("UDP Client");

jLabel7.setFont(new java.awt.Font("Tahoma", 0, 10));
jLabel7.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jLabel7.setText("Remote host IP:");

jLabel8.setFont(new java.awt.Font("Tahoma", 0, 10));
jLabel8.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jLabel8.setText("Remote Host Port:");

jLabel9.setFont(new java.awt.Font("Tahoma", 0, 10));
jLabel9.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jLabel9.setText("Core Pool Size:");

jLabel10.setFont(new java.awt.Font("Tahoma", 0, 10));
jLabel10.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jLabel10.setText("Max. Pool Size:");

jTextFieldRemoteHostPort.setFont(new java.awt.Font("Tahoma", 0, 10));
jTextFieldRemoteHostPort.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jTextFieldRemoteHostPort.setText("5000");

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

jTextFieldMaxPoolSize.setFont(new java.awt.Font("Tahoma", 0, 10));
jTextFieldMaxPoolSize.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jTextFieldMaxPoolSize.setText("16");

jTextFieldCorePoolSize.setFont(new java.awt.Font("Tahoma", 0, 10));
jTextFieldCorePoolSize.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jTextFieldCorePoolSize.setText("8");

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

jTextFieldReadTimeOut.setFont(new java.awt.Font("Tahoma", 0, 10));
jTextFieldReadTimeOut.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jTextFieldReadTimeOut.setText("8000");

jButton5.setFont(new java.awt.Font("Tahoma", 0, 10));
jButton5.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jButton5.setText("Start Sending Messages");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
jButton5ActionPerformed(evt);
}
});

jButton6.setFont(new java.awt.Font("Tahoma", 0, 10));
jButton6.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jButton6.setText("Stop Sending Messages");
jButton6.setEnabled(false);
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
jButton6ActionPerformed(evt);
}
});

jLabel12.setFont(new java.awt.Font("Tahoma", 0, 10));
jLabel12.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jLabel12.setText("Bytes Out:");

jLabel13.setFont(new java.awt.Font("Tahoma", 0, 10));
jLabel13.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jLabel13.setText("Bytes In:");

jLabelBytesIn.setFont(new java.awt.Font("Tahoma", 0, 10));
jLabelBytesIn.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jLabelBytesIn.setText("0");

jLabelBytesOut.setFont(new java.awt.Font("Tahoma", 0, 10));
jLabelBytesOut.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jLabelBytesOut.setText("0");

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
Expand Down Expand Up @@ -152,18 +157,17 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(layout.createSequentialGroup()
.addComponent(jButton5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))))
.addComponent(jButton6))))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel12)
.addComponent(jLabel13))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 283, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 280, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabelBytesIn)
.addComponent(jLabelBytesOut)))
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
.addGap(15, 15, 15))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
Expand Down Expand Up @@ -217,14 +221,14 @@ private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
fUDPClient = new UDPClient("My UDP client", "Example", Integer.parseInt(jTextFieldReadTimeOut.getText()), Integer.parseInt(jTextFieldCorePoolSize.getText()),
Integer.parseInt(jTextFieldMaxPoolSize.getText()), InetAddress.getByName(jTextFieldRemoteHostIP.getText()), Integer.parseInt(jTextFieldRemoteHostPort.getText()));
fUDPClient.Start();

fUpdateStatusActive = true;

fUDPClient.StartSendingMessages();

fUpdateStatusThread = new Thread(new Runnable()
{

@Override
public void run()
{
try
Expand All @@ -236,7 +240,7 @@ public void run()
jLabelBytesIn.setText(String.valueOf(fUDPClient.getBytesIn()));
jLabelBytesOut.setText(String.valueOf(fUDPClient.getBytesOut()));
}
Thread.sleep(1);
Thread.sleep(100);
}
}
catch (Exception ex)
Expand Down Expand Up @@ -275,9 +279,12 @@ private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
}
}//GEN-LAST:event_jButton6ActionPerformed

public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
public static void main(String args[])
{
java.awt.EventQueue.invokeLater(new Runnable()
{
public void run()
{
new frmUDPClient().setVisible(true);
}
});
Expand Down

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit ffcabb7

Please sign in to comment.