This commit is contained in:
trochas
2025-02-25 11:12:15 +01:00
parent 4ac2ee77e4
commit f6bfdbc63a
3 changed files with 9 additions and 5 deletions

View File

@@ -1 +1 @@
hello world 123456

View File

@@ -6,7 +6,7 @@ import java.net.DatagramSocket;
public class TftpDecode { public class TftpDecode {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
int portServeur = 6969; int portServeur = 69;
DatagramSocket dSocket = null; DatagramSocket dSocket = null;
try { try {
// Attends sur le port 6969 // Attends sur le port 6969

View File

@@ -13,7 +13,7 @@ public class TftpPutServeur {
public static void main(String[] args) { public static void main(String[] args) {
try { try {
// Attends sur le port 6969 // Attends sur le port 6969
DatagramSocket socket = new DatagramSocket(6969); DatagramSocket socket = new DatagramSocket(69);
// Boucle // Boucle
while(true){ while(true){
@@ -25,8 +25,11 @@ public class TftpPutServeur {
String requete = new String(buffer); String requete = new String(buffer);
System.out.println("\nPacket");
// Affichage du packet // Affichage du packet
System.out.println("requete : " + requete); affiche(buffer);
System.out.println("\n");
// Attention à ne pas afficher plus d'informations que nécessaire. // Attention à ne pas afficher plus d'informations que nécessaire.
//System.out.println("plus d'informations que nécessaire"); //System.out.println("plus d'informations que nécessaire");
@@ -47,9 +50,10 @@ public class TftpPutServeur {
System.out.println("Send " + seqNumber + " to " + dstAddr); System.out.println("Send " + seqNumber + " to " + dstAddr);
// Construire le paquet avec les bonnes informations // Construire le paquet avec les bonnes informations
byte[] ackBytes = "ack".getBytes(); byte[] ackBytes = ((seqNumber)+"ack").getBytes();
DatagramPacket p = new DatagramPacket(ackBytes,ackBytes.length,dstAddr); DatagramPacket p = new DatagramPacket(ackBytes,ackBytes.length,dstAddr);
System.out.println("Ack");
// afficher le tableau de bytes envoyé // afficher le tableau de bytes envoyé
affiche(ackBytes); affiche(ackBytes);