i
Python functionality and evolution
Installing Python (windows and Ubuntu)
IDLE (Integrated Development and Learning Environment)
Write the first python program and execute it
Keywords in Python
Identifiers in Python
Indentation in Python
Comments in Python
Multi-line Comments in Python
Getting user input
Python Function
Calling a function
Arguments in Function
Scope of Variables
Modules in Python
The PYTHON PATH-Variable
Python File Open
Python File Opening Modes
The file-Object-Attributes
Python File Close() Method
Python File Read/Write
Python File Position
Renaming and Deleting Files in Python
Python Directory Methods
File/Directory Methods
Exceptions in Python
The try-finally Clause
The argument of Exception
Raising Exceptions
Python Built-in Exceptions
Python OOPs Concepts
Python Classes/Objects
Creating Instance Objects
Accessing Attributes
Built-In Class Attributes
Garbage Collection
Python Inheritance
Overriding Methods
Method overriding
Data Hiding
Regular Expression
The match function
The search function
Match Object Methods & Description
Matching or Searching
Search or Replace
Regular Expression Modifiers / Option Flags
Grouping with Parentheses
Python Socket Programming
Python Socket Server
Python Socket Client
Send Data Between Clients
Python Socket or Server
Python Socket Clients
Points to ponder
Socket Programming
The sockets enable programs to send and receive data bi-directionally at any given moment. In this we learn how you can send data from device-to-device, client-to-server, and vice versa using socket programming.
Creating Sockets
Python provides a socket class so developers easily implement socket objects in source code. Should use socket object in program start importing socket library. No need to install with a package manager, it comes out of box with python.
Import socket
Now we can create socket objects insidecode
sock= socket.socket(socket.AF_INET, socket.SOCK_STREAM)
Abovewill creates socket object that we are storing in “sock” variable. The constructor is provided family and type parameter respectively. The family parameter is set the default value, which is Address Format Internet.
The type parameter set to Socket Stream, also default which enables “sequenced, reliable, two-way connection-based byte streams” over TCP1.
Once we initialized socket object, we can use methods to open a connection, send data, receive data and finally close the connection.
sock.connet((‘0.0.0.0’, 8080))
sock.sent(“twenty-five bytes send”)
sock.recv(4096)
sock.close()
Don't miss out!