network bridge learning,bridgelearning,package bof;
分享于 点击 28320 次 点评:188
network bridge learning,bridgelearning,package bof;
package bof;import java.util.Scanner;public class BOF { public static void main(String[] args) { System.out.println("===Please enter a frame with source & destination and port numbers of a bridge, with space between each other:"); Scanner sc = new Scanner(System.in); String str = sc.nextLine(); String[] s = str.split(" "); System.out.println("Source: " + s[0]); System.out.println("Destination: " + s[1]); System.out.println("Arrival at Port Number: " + s[2]); System.out.println("===Please enter current FDB with space between each other:"); Scanner sc1 = new Scanner(System.in); String str1 = sc1.nextLine(); String[] f = str1.split(" "); System.out.println("Current FDB: " + str1); if (s[0].equals(f[0]) && s[2].equals(f[1])) { System.out.println("No update."); } else System.out.println("Update FDB. \\r\\nNew FDB: " + str1 + " " + s[0] + " " + s[2]); if ((s[1].equals(f[0]) && s[2].equals(f[1]))||(s[1].equals(f[2]) && s[2].equals(f[3]))) { System.out.println("Discard."); } else System.out.println("Forward on all out ports."); }}//该片段来自于http://byrx.net
用户点评