The document provides an overview of network programming, emphasizing the roles of servers and clients, as well as the protocols used for communication. It introduces socket programming, detailing the creation and management of server and client sockets, and outlines various applications that can be developed, such as chat applications and network monitoring tools. Key concepts include TCP and UDP protocols, client-server architecture, and the importance of port numbers in network communication.
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
20 views
network programming
The document provides an overview of network programming, emphasizing the roles of servers and clients, as well as the protocols used for communication. It introduces socket programming, detailing the creation and management of server and client sockets, and outlines various applications that can be developed, such as chat applications and network monitoring tools. Key concepts include TCP and UDP protocols, client-server architecture, and the importance of port numbers in network communication.
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13
EE6253 Operating Systems and Network
Programming EE6253 Operating Systems and Network Programming
FUNDAMENTALS OF NETWORK PROGRAMMING
Slides reference: Carleton University, Canada
Introduction • Network Programming involves writing programs/processes that communicate with other programs/processes across a computer network. • A server is an application that provides a "service" to various clients who request the service. • A Protocol is a standard pattern of exchanging information. • High-level application layer protocols; • Hyper Text Transfer Protocol (HTTP) • File Transfer Protocol (FTP) • Telnet. Transport layer communication • How the data is to be transported from one machine to another • Transport Control Protocol (TCP) – connection oriented protocol • User Datagram Protocol (UDP) – connectionless protocol Client server communication • A server - an application that provides a service and allows clients to communicate with it.
• A client - an application that requests a service from a server.
• Client-Server Architecture – one or more servers serve multiple clients • Server waits and listens to the client requests. • Communication initiate when the client connects to the server. • At the end of the process, both client and server terminates their connections. Network Programming - Project • Design and Develop a network programming application enabling communication and data exchange over networks in real time. A few example applications are, • Chat Applications (messaging apps, group chats, etc..) • Applications for sending, receiving, and managing emails. • File Transfer Protocols • Network Monitoring Tools (Applications that monitor network performance, detect issues, etc) • Networked Games (Multiplayer online games..) • Image sharing app • Banking application • Document sharing EE6253 Operating System and Network Programming
INTRODUCTION TO SOCKET PROGRAMMING
Socket • A port is used as a gateway or "entry point" into an application. (netstat -a -b –n - to see the all open port, need admin priviledges) • A socket is one endpoint of a two-way communication link between 2 programs running on the network. A socket is bound to a port number so that the TCP layer can identify the application to which the data is to be sent. • Two types of sockets; • TCP socket (stream) • UDP socket (Datagram) • Socket Number : Combination of an IP address and a Port Number • A socket is bound to a Port through a Port Number • Port numbers range : 0 to 65535 • Known port numbers : Server Socket • Creates a ServerSocket on a given PORT number which could listen to incoming client requests • When creates a ServerSocket – specify the port number • A socket should be created to communicate with the client • After the process, the server socket should be terminated • E.g.:
• Print Writer is used to send information through the socket
Typical Server Program
Create ServerSocket object
Server waits for a client to connect
Set up input and output streams,
send and receive data
Close the connection
Client Socket • Client needs to know the address of the server and the port number • InetAddress object– store the server’s address • A socket is created with the IP address and the Port number of the Server • Input Stream is extracted using a Buffered Reader