Network Software | Computer Networks - Computer Science Engineering (CSE) PDF Download

Network Software
How to implement network software is an essential part of understanding computer networks. This section first introduces some of the issues involved in implementing an application program on top of a network, and then goes on to identify the issues involved in implementing the protocols running within the network. In many respects, network applications and network protocols are very similar—the way an application engages the services of the network is pretty much the same as the way a high-level protocol invokes the services of a low-level protocol.

1 Application Programming Interface (Sockets)
Most network protocols are implemented in software (especially those high in the protocol stack), and nearly all computer systems implement their network protocols as part of the operating system, when we refer to the interface “exported by the network,” we are generally referring to the interface that the OS provides to its networking subsystem. This interface is often called the network application programminginterface (API).

The advantage of industry-wide support for a single API is that applications can be easily ported from one OS to another, and that developers can easily write applications for multiple OSs. Just because two systems support the same network API does not mean that their file system, process, or graphic interfaces are the same. Still, understanding a widely adopted API like Unix sockets gives us a good place to start.

Each protocol provides a certain set of services, and the API provides a syntax by which those services can be invoked in this particular OS.

  • int socket(int domain, int type, int protocol)
  • int bind(int socket, struct sockaddr *address, int addr_len)
  • int listen(int socket, int backlog)
  • int accept(int socket, struct sockaddr *address, int *addr_len)
  • int connect(int socket, struct sockaddr *address, intaddr_len)
  • int send(int socket, char *message, int msg_len, int flags)
  • int recv(int socket, char *buffer, int buf_len, int flags)

2. Example Application
The implementation of a simple client/server program that uses the socket interface to send messages over a TCP connection is discussed. The program also uses other Unix networking utilities, Our application allows a user on one machine to type in and send text to a user on another machine. It is a simplified version of the Unix talk program, which is similar to the program at the core of a web chat room.
Client program :

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#define SERVER_PORT 5432 #define MAX_LINE 256
int
main(int argc, char * argv[])
{
FILE *fp;
struct hostent *hp; struct sockaddr_in sin; char *host;
char buf[MAX_LINE]; int s;
int len;
if (argc==2) { host = argv[1];
}
else {
fprintf(stderr, "usage: simplex-talk host\n"); exit(1);
}
/* translate host name into peer’s IP address */ hp = gethostbyname(host);
if (!hp) {
fprintf(stderr, "simplex-talk: unknown host: %s\n", host); exit(1);
}
/* build address data structure */ bzero((char *)&sin, sizeof(sin)); sin.sin_family = AF_INET;
bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length); sin.sin_port = htons(SERVER_PORT);
/* active open */
if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) { perror("simplex-talk: socket");
exit(1);
}
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { perror("simplex-talk: connect");
close(s);
exit(1);
}
/* main loop: get and send lines of text */
while (fgets(buf, sizeof(buf), stdin)) { buf[MAX_LINE-1] = ’\0’;
len = strlen(buf) + 1; send(s, buf, len, 0);
}
}

Server Program :
#include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h>
#define SERVER_PORT 5432 #define MAX_PENDING 5 #define MAX_LINE 256
int main()
{
struct sockaddr_in sin; char buf[MAX_LINE]; int len;
int s, new_s;
/* build address data structure */ bzero((char *)&sin, sizeof(sin)); sin.sin_family = AF_INET; sin.sin_addr.s_addr = INADDR_ANY; sin.sin_port = htons(SERVER_PORT); /* setup passive open */
if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) { perror("simplex-talk: socket");
exit(1);
}
if ((bind(s, (struct sockaddr *)&sin, sizeof(sin))) < 0) { perror("simplex-talk: bind");
exit(1);
}
listen(s, MAX_PENDING);
/* wait for connection, then receive and print text */ while(1) {
if ((new_s = accept(s, (struct sockaddr *)&sin, &len)) < 0) { perror("simplex-talk: accept");
exit(1);
}
while (len = recv(new_s, buf, sizeof(buf), 0)) fputs(buf, stdout);
close(new_s);
}
}

3 Protocol Implementation Issues
The rest of this section discusses the two primary differences between the network API and the protocol-to-protocol interface found lower in the protocol graph.

Process Model
Most operating systems provide an abstraction called a process, or alternatively, a thread. Each process runs largely independently of other processes, and the OS is responsible for making sure that resources, such as address space and CPU cycles, are allocated to all the current processes.

Message Buffers
A second inefficiency of the socket interface is that the application process provides the buffer that contains the outbound message when calling send, and similarly it provides the buffer into which an incoming message is copied when invoking the receive operation.This forces the topmost protocol to copy the message from the application’s buffer into a network buffer, and vice versa.

The document Network Software | Computer Networks - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Computer Networks.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
21 videos|107 docs|66 tests

Up next

FAQs on Network Software - Computer Networks - Computer Science Engineering (CSE)

1. What is network software?
Ans. Network software refers to a set of programs and applications that enable communication, data transfer, and management of computer networks. It includes protocols, drivers, security tools, and other software components that facilitate the functioning of a network.
2. What are the types of network software?
Ans. There are several types of network software, including: - Network operating systems (NOS): These are specifically designed to manage and control network resources, such as file sharing, printer sharing, and user authentication. Examples include Windows Server, Linux, and Novell NetWare. - Network management software: This type of software is used to monitor, analyze, and control network performance, security, and devices. It helps administrators troubleshoot issues and optimize network performance. Examples include Nagios, SolarWinds, and Cisco Prime. - Network security software: This software is essential for protecting networks from unauthorized access, malware, and other threats. It includes firewalls, antivirus programs, intrusion detection systems (IDS), and virtual private network (VPN) software. - Network protocol analyzers: These tools capture and analyze network traffic, helping administrators diagnose network issues, locate bottlenecks, and ensure optimal network performance. Examples include Wireshark, tcpdump, and Microsoft Network Monitor. - Network backup and recovery software: This software is used to create backups of network data and facilitate its recovery in case of data loss or system failure. Examples include Acronis Backup, Veeam Backup, and Symantec Backup Exec.
3. How do network software and hardware work together?
Ans. Network software and hardware work together to enable communication and data transfer within a network. Network hardware includes routers, switches, network cables, and other physical components that facilitate the movement of data. On the other hand, network software provides the necessary protocols, drivers, and applications to control and manage the hardware. For example, when a user sends an email, the email client software on their device uses network protocols (such as SMTP) to package and transmit the email data over the network. The network hardware, such as routers and switches, receives the data and forwards it to the destination device using the appropriate network protocols. The destination device's network software receives the data, interprets it, and delivers it to the email server software, which then stores the email for the recipient. In summary, network hardware provides the physical infrastructure for data transmission, while network software ensures that the data is properly packaged, transmitted, and received by the devices on the network.
4. What are the key challenges in managing network software?
Ans. Managing network software can pose several challenges, including: - Compatibility issues: Network software needs to be compatible with the underlying hardware, operating systems, and other software components. Ensuring compatibility and managing updates across different devices and software versions can be complex. - Security vulnerabilities: Network software, particularly operating systems and security tools, may have vulnerabilities that can be exploited by hackers. Regular updates and patches are necessary to address these vulnerabilities and maintain network security. - Performance optimization: Network software needs to be properly configured and optimized to ensure efficient data transfer, minimize latency, and avoid bottlenecks. This requires monitoring and analysis of network performance metrics. - Scalability: As networks grow in size and complexity, managing network software becomes more challenging. Ensuring that software can scale to accommodate increasing network demands and user requirements is crucial. - Troubleshooting: When network issues arise, diagnosing and troubleshooting software-related problems can be time-consuming. Network administrators need to have the necessary knowledge and tools to identify and resolve software-related issues.
5. How can network software be secured against cyber threats?
Ans. Securing network software against cyber threats involves implementing several measures, including: - Regular updates and patches: Keeping network software up to date with the latest security patches is essential to prevent exploitation of known vulnerabilities. Regularly checking for updates from software vendors and promptly applying them can enhance network security. - Firewalls and intrusion detection systems: Deploying firewalls and intrusion detection systems (IDS) can help monitor and control network traffic, blocking unauthorized access attempts and detecting suspicious activities. - Antivirus and anti-malware software: Installing and regularly updating antivirus and anti-malware software on all network devices can help detect and remove malicious software that can compromise network security. - User authentication and access controls: Implementing strong user authentication mechanisms, such as passwords or multi-factor authentication, and enforcing access controls can prevent unauthorized access to network resources. - Encryption: Using encryption protocols and technologies, such as SSL/TLS for data transmission and VPNs for secure remote access, can protect sensitive data from interception and unauthorized access. - Employee training and awareness: Educating network users about best practices for network security, such as avoiding phishing emails, using secure passwords, and being cautious with file downloads, can help prevent security breaches caused by human error. By implementing these security measures and regularly assessing and updating network software, organizations can enhance the security of their networks and protect against cyber threats.
21 videos|107 docs|66 tests
Download as PDF

Up next

Explore Courses for Computer Science Engineering (CSE) exam
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

video lectures

,

Important questions

,

study material

,

Sample Paper

,

MCQs

,

Viva Questions

,

Extra Questions

,

ppt

,

Summary

,

pdf

,

shortcuts and tricks

,

mock tests for examination

,

Previous Year Questions with Solutions

,

Network Software | Computer Networks - Computer Science Engineering (CSE)

,

Free

,

past year papers

,

Network Software | Computer Networks - Computer Science Engineering (CSE)

,

Network Software | Computer Networks - Computer Science Engineering (CSE)

,

Exam

,

Objective type Questions

,

Semester Notes

,

practice quizzes

;