WikiGalaxy

Personalize

Application Layer Protocols

HTTP (Hypertext Transfer Protocol):

HTTP is the foundation of any data exchange on the Web and a protocol used for transferring hypertext requests and information on the internet.

FTP (File Transfer Protocol):

FTP is used to transfer files between computers on a network. It is built on a client-server model architecture.

SMTP (Simple Mail Transfer Protocol):

SMTP is an Internet standard for email transmission across Internet Protocol (IP) networks.

DNS (Domain Name System):

DNS translates domain names to IP addresses so browsers can load Internet resources.


      // Example of a simple HTTP GET request in Java
      import java.net.*;
      import java.io.*;

      public class HttpExample {
          public static void main(String[] args) throws Exception {
              URL url = new URL("http://www.example.com");
              HttpURLConnection con = (HttpURLConnection) url.openConnection();
              con.setRequestMethod("GET");

              int status = con.getResponseCode();
              BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
              String inputLine;
              StringBuffer content = new StringBuffer();
              while ((inputLine = in.readLine()) != null) {
                  content.append(inputLine);
              }
              in.close();
              con.disconnect();
              System.out.println(content.toString());
          }
      }
    

Console Output:

[HTML content of the page]

Transport Layer Protocols

TCP (Transmission Control Protocol):

TCP is a connection-oriented protocol that ensures reliable communication by establishing a connection before transmitting data.

UDP (User Datagram Protocol):

UDP is a connectionless protocol that allows data to be sent without establishing a connection, offering faster but less reliable communication.


      // Example of a simple TCP client in Java
      import java.io.*;
      import java.net.*;

      public class TcpClient {
          public static void main(String[] args) {
              try (Socket socket = new Socket("localhost", 6666)) {
                  DataOutputStream dout = new DataOutputStream(socket.getOutputStream());
                  dout.writeUTF("Hello Server");
                  dout.flush();
                  dout.close();
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
      }
    

Console Output:

Message sent to server

Network Layer Protocols

IP (Internet Protocol):

IP is responsible for addressing and routing packets of data so that they can travel across networks and arrive at the correct destination.

ICMP (Internet Control Message Protocol):

ICMP is used by network devices to send error messages and operational information indicating success or failure when communicating with another IP address.


      // Example of sending a ping request using ICMP in Java
      import java.io.*;
      import java.net.*;

      public class IcmpPing {
          public static void main(String[] args) {
              try {
                  InetAddress inet = InetAddress.getByName("www.google.com");
                  System.out.println("Sending Ping Request to " + inet);
                  if (inet.isReachable(5000)) {
                      System.out.println("Host is reachable");
                  } else {
                      System.out.println("Host is NOT reachable");
                  }
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
      }
    

Console Output:

Host is reachable

Data Link Layer Protocols

Ethernet:

Ethernet is a family of networking technologies used for local area networks (LANs), defining wiring and signaling standards for the physical layer of the OSI model.

PPP (Point-to-Point Protocol):

PPP is a data link layer communication protocol used to establish a direct connection between two nodes.


      // Example of simulating a simple Ethernet frame transmission in Java
      public class EthernetFrame {
          public static void main(String[] args) {
              String sourceMac = "00:0a:95:9d:68:16";
              String destMac = "00:0a:95:9d:68:ff";
              String payload = "Hello Ethernet";

              System.out.println("Source MAC: " + sourceMac);
              System.out.println("Destination MAC: " + destMac);
              System.out.println("Payload: " + payload);
          }
      }
    

Console Output:

Source MAC: 00:0a:95:9d:68:16

Destination MAC: 00:0a:95:9d:68:ff

Payload: Hello Ethernet

Physical Layer Protocols

DSL (Digital Subscriber Line):

DSL is a family of technologies that provide internet access by transmitting digital data over the wires of a local telephone network.

Fiber Optics:

Fiber optics is a technology that uses glass or plastic threads to transmit data as light pulses.


      // Example of simulating a simple light signal transmission in Java
      public class FiberOptics {
          public static void main(String[] args) {
              String signal = "Light Pulse Signal";
              System.out.println("Transmitting: " + signal);
          }
      }
    

Console Output:

Transmitting: Light Pulse Signal

Session Layer Protocols

NetBIOS (Network Basic Input/Output System):

NetBIOS provides services related to the session layer of the OSI model, allowing applications on separate computers to communicate over a local area network.

PPTP (Point-to-Point Tunneling Protocol):

PPTP is a method for implementing virtual private networks, providing a secure connection over the internet.


      // Example of establishing a simple session using NetBIOS in Java
      public class NetBiosSession {
          public static void main(String[] args) {
              System.out.println("Establishing NetBIOS session...");
              // Simulate session establishment
              System.out.println("Session established successfully.");
          }
      }
    

Console Output:

Establishing NetBIOS session...

Session established successfully.

Presentation Layer Protocols

TLS (Transport Layer Security):

TLS is a cryptographic protocol designed to provide communications security over a computer network.

SSL (Secure Sockets Layer):

SSL is the standard technology for keeping an internet connection secure and safeguarding any sensitive data that is being sent between two systems.


      // Example of a simple TLS connection in Java
      import javax.net.ssl.*;
      import java.io.*;
      import java.security.KeyManagementException;
      import java.security.NoSuchAlgorithmException;

      public class TlsExample {
          public static void main(String[] args) throws IOException, NoSuchAlgorithmException, KeyManagementException {
              SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
              try (SSLSocket socket = (SSLSocket) factory.createSocket("www.example.com", 443)) {
                  socket.startHandshake();
                  System.out.println("TLS Handshake successful");
              }
          }
      }
    

Console Output:

TLS Handshake successful

Network Layer Protocols

IPv4:

IPv4 is the fourth version of the Internet Protocol (IP) and it routes most of the traffic on the Internet today.

IPv6:

IPv6 is the most recent version of the Internet Protocol, designed to eventually replace IPv4 due to its larger address space.


      // Example of checking IPv4 address in Java
      import java.net.*;

      public class CheckIPv4 {
          public static void main(String[] args) {
              try {
                  InetAddress inet = InetAddress.getByName("www.example.com");
                  System.out.println("IPv4 Address: " + inet.getHostAddress());
              } catch (UnknownHostException e) {
                  e.printStackTrace();
              }
          }
      }
    

Console Output:

IPv4 Address: 93.184.216.34

Transport Layer Protocols

SCTP (Stream Control Transmission Protocol):

SCTP is a transport layer protocol used in computer networking that serves a similar role as the popular protocols TCP and UDP.

DCCP (Datagram Congestion Control Protocol):

DCCP is a message-oriented transport layer protocol that implements reliable connection setup, teardown, and congestion control.


      // Example of a simple SCTP connection in Java (hypothetical, as Java lacks SCTP support)
      public class SctpExample {
          public static void main(String[] args) {
              System.out.println("SCTP connection simulation");
              // Simulate SCTP connection
              System.out.println("SCTP connection established");
          }
      }
    

Console Output:

SCTP connection simulation

SCTP connection established

logo of wikigalaxy

Newsletter

Subscribe to our newsletter for weekly updates and promotions.

Privacy Policy

 • 

Terms of Service

Copyright © WikiGalaxy 2025