Python Programming - Standard Libraries - Discussion

Discussion Forum : Standard Libraries - General Questions (Q.No. 81)
81.
What is the purpose of the socket module?
Sorting elements in a list
Handling exceptions and errors
Working with cryptographic hash functions
Implementing network communication
Answer: Option
Explanation:
import socket

# Example usage of socket module for creating a simple server
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.bind(('localhost', 8080))
server_socket.listen(1)
connection, address = server_socket.accept()
print(f"Connected by {address}")
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.