This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.net.*; | |
| import java.io.*; | |
| import java.util.Scanner; | |
| public class ChatClient | |
| { | |
| public final static int PORT = 5555; | |
| public final static String ADDR = "localhost"; | |
| public static void main(String[] args) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.net.*; | |
| import java.io.*; | |
| import java.util.Scanner; | |
| public class ChatServer | |
| { | |
| public final static int PORT = 5555; | |
| public static void main(String[] args) | |
| { | |
| try |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.net.*; | |
| import java.io.*; | |
| import java.util.*; | |
| public class StopAndWaitClient { | |
| public static void main(String[] args) { | |
| try { | |
| Socket sock = new Socket("localhost", 1500); | |
| DataOutputStream toServer = new DataOutputStream(sock.getOutputStream()); | |
| BufferedReader fromServer = new BufferedReader(new InputStreamReader(sock.getInputStream())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.net.*; | |
| import java.io.*; | |
| import java.util.*; | |
| public class StopAndWaitServer { | |
| public static void main (String args[]) { | |
| try { | |
| ServerSocket sock = new ServerSocket(1500); | |
| Socket s = sock.accept(); | |
| String[] ack = {"ACK1", "ACK2", "ACK3", "ACK4", "ACK5"}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.net.*; | |
| public class AllIpGoogle | |
| { | |
| public static void main(String[] args) | |
| { | |
| try | |
| { | |
| InetAddress[] addresses = InetAddress.getAllByName("google.com"); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.net.*; | |
| import java.util.Scanner; | |
| public class PortScanner | |
| { | |
| public static void main(String[] args) | |
| { | |
| try | |
| { | |
| int start, end; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.net.*; | |
| import java.util.Scanner; | |
| public class AllIpRemote | |
| { | |
| public static void main(String[] args) | |
| { | |
| try | |
| { | |
| Scanner scanner = new Scanner(System.in); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.net.*; | |
| import java.util.Scanner; | |
| public class PortScanner | |
| { | |
| public static void main(String[] args) | |
| { | |
| try | |
| { | |
| int start, end; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.net.InetAddress; | |
| import java.util.Scanner; | |
| public class Ping | |
| { | |
| public static void main(String[] args) | |
| { | |
| String address; | |
| Scanner sc = new Scanner(System.in); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.*; | |
| import java.net.*; | |
| public class MulticastClient | |
| { //Client1, Client2, Client3 for 3 different clients | |
| final static String INET_ADDR = "224.0.113.3"; | |
| final static int PORT = 8000; //8000, 8001, 8002 for 3 different clients | |
| public static void main(String[] args) throws Exception | |
| { |