aggiornamento codice
This commit is contained in:
2
USocket/.gitignore
vendored
2
USocket/.gitignore
vendored
@@ -1 +1 @@
|
||||
/build/
|
||||
/build/
|
||||
@@ -70,4 +70,4 @@
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
||||
</project>
|
||||
BIN
USocket/dist/USocket.jar
vendored
BIN
USocket/dist/USocket.jar
vendored
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
build.xml.data.CRC32=73e21a97
|
||||
build.xml.script.CRC32=905bb893
|
||||
build.xml.stylesheet.CRC32=f85dc8f2@1.102.0.48
|
||||
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=73e21a97
|
||||
|
||||
@@ -10,6 +10,13 @@ public class UDatagram {
|
||||
|
||||
static final int dim_buffer = 1024;
|
||||
|
||||
/**
|
||||
* Inizializza un DatagramSocket server in ascolto sulla porta scelta e restituisce il messaggio una volta ricevuto da remoto
|
||||
* @param porta Porta che userà il server per rimanere in ascolto
|
||||
* @return stringa contenente il messaggio ricevuto da remoto
|
||||
* @throws SocketException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static String listenString(int porta) throws SocketException, IOException {
|
||||
|
||||
DatagramSocket server = new DatagramSocket(porta);
|
||||
@@ -27,6 +34,13 @@ public class UDatagram {
|
||||
return messaggio;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inizializza un DatagramSocket lato client che trasmette il messaggio scelto all'indirizzo e alla porta passata come parametro
|
||||
* @param host Indirizzo IP del destinatario
|
||||
* @param porta Porta del server remoto in ascolto
|
||||
* @param messaggio Messaggio da trasmettere al server remoto
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void writeString(String host, int porta, String messaggio) throws IOException {
|
||||
|
||||
InetAddress destinatario = InetAddress.getByName(host);
|
||||
|
||||
Reference in New Issue
Block a user