This document discusses socket programming in Python. It covers what sockets are, how to create them in Python, common port numbers and protocols, important socket methods, the roles of clients and servers in communication, and how to transfer Python objects using sockets and the pickle module.
Definition of sockets, client-server communication basics, and types of programs (servers and clients). Key topics include sending/receiving data and socket characteristics.
Definition of sockets, client-server communication basics, and types of programs (servers and clients). Key topics include sending/receiving data and socket characteristics.
Overview of common port numbers with associated protocols like HTTP(80), FTP(20), SMTP(25) for various applications.
Introduction to the socket module, methods for creating and managing sockets including socket creation and connection handling.
Definition of sockets, client-server communication basics, and types of programs (servers and clients). Key topics include sending/receiving data and socket characteristics.
Definition of client and server roles in networking, with emphasis on data transfer capabilities including the use of the pickle module for object transfer.
• What aresockets? • How to achieve Socket Programming in Python? • Servers and Clients • Client-Server Communication • Transferring Python Objects www.edureka.co/python
• Sockets areinterior endpoints built for sending and receiving data • A single network will have two sockets • Sockets are a combination of an IP address and a Port www.edureka.co/python
5.
Protocol Port NumberPython Library Function HTTP 80 httplib, urllib,xmlrpclib Web pages FTP 20 ftplib, urllib File transfers NNTP 119 nntplib Unsent news SMTP 25 smtplib Sending email Telnet 23 telnetlib Command lines POP3 110 poplib Fetching email Gopher 70 gopherlib Document transfer Common port numbers and the related protocols Common Port Numbers www.edureka.co/python
• Import thesocket module or framework • This module consists of built-in methods that are required for creating sockets and help them associate with each other www.edureka.co/python
8.
Methods Description socket.socket() Used tocreate sockets (required on both server as well as client ends to create sockets) socket.accept() Used to accept a connection. It returns a pair of values (conn, address) socket.bind() Used to bind to the address that is specified as a parameter socket.close() Used to bind to the address that is specified as a parameter socket.connect() Used to mark the socket as closed socket.listen() Used to connect to a remote address specified as the parameter Important methods of the socket module www.edureka.co/python
www.edureka.co/python • Either aprogram, a computer, or a device • Devoted to managing network resources • Can be on the same device or computer or local or even remote Server Client • Computer or software that receives information or services • Clients requests for services from servers • The best example is a web browser www.edureka.co/python
• Socket Programmingin Python also allows you to transfer Python objects such as sets, tuples, dictionaries, etc. • To achieve this, you need to import the pickle module. www.edureka.co/python