inserimento codice socket udp
This commit is contained in:
149
.gitignore
vendored
149
.gitignore
vendored
@@ -1 +1,148 @@
|
||||
/ClientPersistente/dist/
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
**/nbproject/private/
|
||||
**/nbproject/Makefile-*.mk
|
||||
**/nbproject/Package-*.bash
|
||||
build/
|
||||
nbbuild/
|
||||
dist/
|
||||
nbdist/
|
||||
.nb-gradle/
|
||||
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
.idea/
|
||||
cmake-build-*/
|
||||
# File-based project format
|
||||
*.iws
|
||||
# IntelliJ
|
||||
out/
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
### - NetBeans
|
||||
**/nbproject/private/
|
||||
**/nbproject/Makefile-*.mk
|
||||
**/nbproject/Package-*.bash
|
||||
build/
|
||||
nbbuild/
|
||||
nbdist/
|
||||
.nb-gradle/
|
||||
### - Visual Studio Code
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/*.code-snippets
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
||||
### - XCode
|
||||
## User settings
|
||||
xcuserdata/
|
||||
## Xcode 8 and earlier
|
||||
*.xcscmblueprint
|
||||
*.xccheckout
|
||||
|
||||
##### - Linux
|
||||
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
##### - Windows
|
||||
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
##### - MacOS
|
||||
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
@@ -1,4 +0,0 @@
|
||||
#Wed, 01 Feb 2023 15:55:04 +0100
|
||||
|
||||
|
||||
/home/boss/Progetti/ClientAccademico=
|
||||
Binary file not shown.
@@ -1,4 +0,0 @@
|
||||
#Thu, 02 Feb 2023 00:11:23 +0100
|
||||
|
||||
|
||||
/home/boss/Progetti/Didattica_Socket/ClientPersistente=
|
||||
Binary file not shown.
73
ClientSconnesso/build.xml
Normal file
73
ClientSconnesso/build.xml
Normal file
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="ClientSconnesso" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project ClientSconnesso.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar: JAR building
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="ClientSconnesso-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
||||
Binary file not shown.
3
ClientSconnesso/manifest.mf
Normal file
3
ClientSconnesso/manifest.mf
Normal file
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
||||
1771
ClientSconnesso/nbproject/build-impl.xml
Normal file
1771
ClientSconnesso/nbproject/build-impl.xml
Normal file
File diff suppressed because it is too large
Load Diff
8
ClientSconnesso/nbproject/genfiles.properties
Normal file
8
ClientSconnesso/nbproject/genfiles.properties
Normal file
@@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=3637ba01
|
||||
build.xml.script.CRC32=a66f0622
|
||||
build.xml.stylesheet.CRC32=f85dc8f2@1.105.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=3637ba01
|
||||
nbproject/build-impl.xml.script.CRC32=2a0a287b
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.105.0.48
|
||||
2
ClientSconnesso/nbproject/private/private.properties
Normal file
2
ClientSconnesso/nbproject/private/private.properties
Normal file
@@ -0,0 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=/home/docente/.netbeans/16/build.properties
|
||||
4
ClientSconnesso/nbproject/private/private.xml
Normal file
4
ClientSconnesso/nbproject/private/private.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
</project-private>
|
||||
97
ClientSconnesso/nbproject/project.properties
Normal file
97
ClientSconnesso/nbproject/project.properties
Normal file
@@ -0,0 +1,97 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processor.options=
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.modulepath=\
|
||||
${run.modulepath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
debug.test.modulepath=\
|
||||
${run.test.modulepath}
|
||||
# Files in build.classes.dir which should be excluded from distribution jar
|
||||
dist.archive.excludes=
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/ClientSconnesso.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
dist.jlink.dir=${dist.dir}/jlink
|
||||
dist.jlink.output=${dist.jlink.dir}/ClientSconnesso
|
||||
excludes=
|
||||
file.reference.USocket.jar=/home/docente/Modelli/USocket.jar
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=\
|
||||
${file.reference.USocket.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.external.vm=true
|
||||
javac.modulepath=
|
||||
javac.processormodulepath=
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=17
|
||||
javac.target=17
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.modulepath=\
|
||||
${javac.modulepath}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.html5=false
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
# The jlink additional root modules to resolve
|
||||
jlink.additionalmodules=
|
||||
# The jlink additional command line parameters
|
||||
jlink.additionalparam=
|
||||
jlink.launcher=true
|
||||
jlink.launcher.name=ClientSconnesso
|
||||
main.class=clientsconnesso.ClientSconnesso
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project.
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
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
|
||||
15
ClientSconnesso/nbproject/project.xml
Normal file
15
ClientSconnesso/nbproject/project.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>ClientSconnesso</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
19
ClientSconnesso/src/clientsconnesso/ClientSconnesso.java
Normal file
19
ClientSconnesso/src/clientsconnesso/ClientSconnesso.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package clientsconnesso;
|
||||
|
||||
import com.mirimatcode.UDatagram;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClientSconnesso {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO code application logic here
|
||||
String messaggio = "Ciao amico server";
|
||||
|
||||
try {
|
||||
UDatagram.writeString("192.168.1.175", 5000, messaggio);
|
||||
} catch (IOException ex) {
|
||||
System.out.println(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
#Wed, 01 Feb 2023 15:45:34 +0100
|
||||
|
||||
|
||||
/home/boss/Progetti/ServerAccademico=
|
||||
Binary file not shown.
@@ -1,2 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=/home/boss/.netbeans/16/build.properties
|
||||
user.properties.file=/home/docente/.netbeans/16/build.properties
|
||||
|
||||
4
ServerAccademico/nbproject/private/private.xml
Normal file
4
ServerAccademico/nbproject/private/private.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
</project-private>
|
||||
@@ -1,4 +0,0 @@
|
||||
#Thu, 02 Feb 2023 00:11:26 +0100
|
||||
|
||||
|
||||
/home/boss/Progetti/Didattica_Socket/ServerPersistente=
|
||||
Binary file not shown.
107
ServerSconnesso/build.xml
Normal file
107
ServerSconnesso/build.xml
Normal file
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="ServerSconnesso" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project ServerSconnesso.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar: JAR building
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="ServerSconnesso-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
<target name="-post-jar">
|
||||
|
||||
<!-- Change the value to the name of the final jar without .jar -->
|
||||
<property name="store.jar.name" value="ServerSconnesso"/>
|
||||
|
||||
<!-- don't edit below this line -->
|
||||
<property name="store.dir" value="dist"/>
|
||||
<property name="temp.dir" value="temp"/>
|
||||
<property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>
|
||||
|
||||
<echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>
|
||||
|
||||
<delete dir="${temp.dir}"/>
|
||||
<mkdir dir="${temp.dir}"/>
|
||||
|
||||
<jar destfile="${temp.dir}/temp_final.jar" filesetmanifest="skip">
|
||||
<zipgroupfileset dir="dist" includes="*.jar"/>
|
||||
<zipgroupfileset dir="dist/lib" includes="*.jar"/>
|
||||
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main.class}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
|
||||
<delete dir="${store.dir}"/>
|
||||
|
||||
<zip destfile="${store.jar}">
|
||||
<zipfileset src="${temp.dir}/temp_final.jar"
|
||||
excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
|
||||
</zip>
|
||||
|
||||
<delete dir="${temp.dir}"/>
|
||||
|
||||
</target>
|
||||
</project>
|
||||
4
ServerSconnesso/build/built-jar.properties
Normal file
4
ServerSconnesso/build/built-jar.properties
Normal file
@@ -0,0 +1,4 @@
|
||||
#Fri, 03 Feb 2023 12:12:07 +0100
|
||||
|
||||
|
||||
/home/docente/Progetti/ServerSconnesso=
|
||||
Binary file not shown.
BIN
ServerSconnesso/dist/ServerSconnesso.jar
vendored
Normal file
BIN
ServerSconnesso/dist/ServerSconnesso.jar
vendored
Normal file
Binary file not shown.
3
ServerSconnesso/manifest.mf
Normal file
3
ServerSconnesso/manifest.mf
Normal file
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
||||
1771
ServerSconnesso/nbproject/build-impl.xml
Normal file
1771
ServerSconnesso/nbproject/build-impl.xml
Normal file
File diff suppressed because it is too large
Load Diff
8
ServerSconnesso/nbproject/genfiles.properties
Normal file
8
ServerSconnesso/nbproject/genfiles.properties
Normal file
@@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=ac40c2b2
|
||||
build.xml.script.CRC32=5da9665b
|
||||
build.xml.stylesheet.CRC32=f85dc8f2@1.105.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=ac40c2b2
|
||||
nbproject/build-impl.xml.script.CRC32=80d3de00
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.105.0.48
|
||||
2
ServerSconnesso/nbproject/private/private.properties
Normal file
2
ServerSconnesso/nbproject/private/private.properties
Normal file
@@ -0,0 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=/home/docente/.netbeans/16/build.properties
|
||||
4
ServerSconnesso/nbproject/private/private.xml
Normal file
4
ServerSconnesso/nbproject/private/private.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
</project-private>
|
||||
97
ServerSconnesso/nbproject/project.properties
Normal file
97
ServerSconnesso/nbproject/project.properties
Normal file
@@ -0,0 +1,97 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processor.options=
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.modulepath=\
|
||||
${run.modulepath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
debug.test.modulepath=\
|
||||
${run.test.modulepath}
|
||||
# Files in build.classes.dir which should be excluded from distribution jar
|
||||
dist.archive.excludes=
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/ServerSconnesso.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
dist.jlink.dir=${dist.dir}/jlink
|
||||
dist.jlink.output=${dist.jlink.dir}/ServerSconnesso
|
||||
excludes=
|
||||
file.reference.USocket.jar=/home/docente/Modelli/USocket.jar
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=\
|
||||
${file.reference.USocket.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.external.vm=true
|
||||
javac.modulepath=
|
||||
javac.processormodulepath=
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=17
|
||||
javac.target=17
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.modulepath=\
|
||||
${javac.modulepath}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.html5=false
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
# The jlink additional root modules to resolve
|
||||
jlink.additionalmodules=
|
||||
# The jlink additional command line parameters
|
||||
jlink.additionalparam=
|
||||
jlink.launcher=true
|
||||
jlink.launcher.name=ServerSconnesso
|
||||
main.class=serversconnesso.ServerSconnesso
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project.
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
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
|
||||
15
ServerSconnesso/nbproject/project.xml
Normal file
15
ServerSconnesso/nbproject/project.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>ServerSconnesso</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
17
ServerSconnesso/src/serversconnesso/ServerSconnesso.java
Normal file
17
ServerSconnesso/src/serversconnesso/ServerSconnesso.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package serversconnesso;
|
||||
|
||||
import com.mirimatcode.UDatagram;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ServerSconnesso {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
try {
|
||||
String messaggio_ricevuto = UDatagram.listenString(5000);
|
||||
System.out.println("Ho ricevuto qualcosa del genere: " + messaggio_ricevuto);
|
||||
} catch (IOException ex) {
|
||||
System.out.println(ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
USocket/dist/USocket.jar
vendored
BIN
USocket/dist/USocket.jar
vendored
Binary file not shown.
@@ -1,2 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=/home/boss/.netbeans/16/build.properties
|
||||
user.properties.file=/home/docente/.netbeans/16/build.properties
|
||||
|
||||
42
USocket/src/com/mirimatcode/UDatagram.java
Normal file
42
USocket/src/com/mirimatcode/UDatagram.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.mirimatcode;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.DatagramPacket;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.InetAddress;
|
||||
import java.net.SocketException;
|
||||
|
||||
public class UDatagram {
|
||||
|
||||
static final int dim_buffer = 1024;
|
||||
|
||||
public static String listenString(int porta) throws SocketException, IOException {
|
||||
|
||||
DatagramSocket server = new DatagramSocket(porta);
|
||||
byte[] buffer = new byte[dim_buffer];
|
||||
DatagramPacket pacchetto = new DatagramPacket(buffer, dim_buffer);
|
||||
|
||||
System.out.println("Datagram Server in ascolto");
|
||||
server.receive(pacchetto);
|
||||
|
||||
System.out.println("Ho ricevuto un messaggio da: " + pacchetto.getAddress().getHostAddress());
|
||||
String messaggio = new String(pacchetto.getData());
|
||||
|
||||
server.close();
|
||||
|
||||
return messaggio;
|
||||
}
|
||||
|
||||
public static void writeString(String host, int porta, String messaggio) throws IOException {
|
||||
|
||||
InetAddress destinatario = InetAddress.getByName(host);
|
||||
DatagramSocket client = new DatagramSocket();
|
||||
|
||||
byte[] flusso_messaggio = messaggio.getBytes();
|
||||
DatagramPacket pacchetto = new DatagramPacket(flusso_messaggio, flusso_messaggio.length, destinatario, porta);
|
||||
|
||||
client.send(pacchetto);
|
||||
|
||||
client.close();
|
||||
}
|
||||
}
|
||||
@@ -97,6 +97,7 @@ public class USocket {
|
||||
* @throws UnknownHostException
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
public static String writeAndListenString(String ip, int porta, String messaggio) throws UnknownHostException, IOException {
|
||||
Socket client = new Socket(ip, porta);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user