Network Lab Output - 120819
Network Lab Output - 120819
Network Lab Output - 120819
3) traceroute
4) tracepath
5) ping
6) netstat
7) ss
8) dig
9) nslookup
11) arp
12) whois
13) host
14) curl
Experiment 4
UDPServerEx.java
import java.net.*;
class UDPServerEx {
public static DatagramSocket mySocket;
public static byte myBuffer[] = new byte[2000];
import java.net.*;
class UDPClient {
import java.io.*;
import java.net.*;
class GFG {
// driver function
public static void main(String[] args)
{
try {
// Create socket object by passing id address
// and port number establish connection
Socket socket = new Socket("localhost", 1346);
System.out.println( "Connected Successfully.....");
// Buffer reader to get all the input stream
InputStreamReader r = new InputStreamReader(System.in)
BufferedReader bs = new BufferedReader( r );
System.out.println("Response from Server.....");
// Print response from server
System.out.println("Client Side : "+ bs.readLine());
// Close the connection
socket.close();
}
catch (UnknownHostException e) {
// Catch block for IP errors
System.out.println("IP not found for" + e);
}
catch (IOException e) {
// Catch block for data stream errors
System.out.println("Not found data for socket"+ e);
}
}
}
import java.io.*;
import java.net.*;
class GFG {
public static void main(String[] args)
{
try {
// establish connection
ServerSocket serversocket = new ServerSocket(1346);
System.out.println("waiting for request....");
// Socket object to accept all the connections
Socket socket = serversocket.accept();
System.out.println("Request Accepted...");
// Printstream to print all the data
PrintStream ps = new PrintStream(socket.getOutputStream());
BufferedReader br = new BufferedReader( new
InputStreamReader(System.in));
System.out.println( "Input the data at the server...");
// Printing bufferedreader data
ps.print(br.readLine());
socket.close();
serversocket.close();
}
catch (IOException e) {
// Catch block for data stream errors
System.out.println("Not found data for socket" + e);
}
}
}