To develop the IMAP (Internet Message Access Protocol) and POP3 (Post Office Protocol v3) email protocol projects using NS-3 has includes the replicate a network communication among their mail clients and mail servers to examine the performance metrics such as latency, bandwidth usage, and scalability.
Steps to Develop IMAP/POP3 Email Protocol Projects in NS-3
- Setup NS-3 Environment
Before opening, assure which NS-3 is installed on your system. If not, install it using the following commands:
sudo apt update
sudo apt install git
git clone
cd ns-3-dev
./ns3 configure
./ns3 build
- Define Network Topology
- Model the network by Mail Clients, Mail Servers, and Routers.
- We allocate the IP addresses and describe the connection among their nodes.
- We utilized the TCP/IP for consistent the email communication.
- Implement IMAP and POP3 Protocols
In NS-3, IMAP and POP3 can be replicated using application-layer congestion design. Since NS-3 cannot have built-in IMAP/POP3 models, we can use Socket APIs to follow their behaviors.
- IMAP (Port 143 / 993 for SSL)
- Handle the communication on the server.
- We permit the several devices to access emails.
- POP3 (Port 110 / 995 for SSL)
- Downloads the emails and removes them from the server.
We utilized the BulkSendApplication and PacketSink to design the email communication among their clients and servers.
- Simulate Email Traffic using Applications
Build a custom application for replicate an IMAP/POP3 communication:
- TcpSocketFactory used for IMAP/POP3 transactions.
- Apply the execution of Packet Exchange among their clients and servers.
Example Code:
Ptr<Node> client = CreateObject<Node>();
Ptr<Node> server = CreateObject<Node>();
NodeContainer network(client, server);
PointToPointHelper p2p;
p2p.SetDeviceAttribute (“DataRate”, StringValue (“10Mbps”));
p2p.SetChannelAttribute (“Delay”, StringValue (“2ms”));
NetDeviceContainer devices = p2p.Install(network);
InternetStackHelper internet;
internet.Install(network);
Ipv4AddressHelper ipv4;
ipv4.SetBase (“192.168.1.0”, “255.255.255.0”);
Ipv4InterfaceContainer interfaces = ipv4.Assign(devices);
uint16_t port = 143; // IMAP Server Port
Address serverAddress(InetSocketAddress(interfaces.GetAddress(1), port));
PacketSinkHelper sink(“ns3::TcpSocketFactory”, serverAddress);
ApplicationContainer serverApp = sink.Install(server);
serverApp.Start(Seconds(1.0));
serverApp.Stop(Seconds(10.0));
BulkSendHelper clientHelper(“ns3::TcpSocketFactory”, serverAddress);
ApplicationContainer clientApp = clientHelper.Install(client);
clientApp.Start(Seconds(2.0));
clientApp.Stop(Seconds(9.0));
Simulator::Run();
Simulator::Destroy();
- Add Security Features
For SSL/TLS Encryption (IMAPS and POP3S), we can require to incorporate the OpenSSL and replicate a Secure Socket Layer (SSL) connections in NS-3.
- Performance Analysis
The NS-3 used to estimate for FlowMonitor and NetAnim:
- Email communication delay
- Packet loss and throughput
- Server response time
Example:
FlowMonitorHelper flowmon;
Ptr<FlowMonitor> monitor = flowmon.InstallAll();
monitor->SerializeToXmlFile(“imap-pop3-results.xml”, true, true);
- Visualization & Results
- Used to see the email modification in NetAnim.
- Distribute the data for graphical analysis using Python or MATLAB.
Extensions for Advanced Research
- IMAP vs POP3 Performance Comparison of high-latency networks.
- Effect of Network Congestion in email protocols.
- Security Analysis of IMAP/POP3 using TLS in NS-3.
In general, we had implemented and executed IMAP POP3 protocol in ns3 environment and In case of more questions are needed we will use another document for explanation