I am new to Python. I am writing a Server program and a Client program. In here, Server plays the role of distributing the data to the multiple clients. It works great. My task is to distribute the data from the server by using server.py file. Whenever any clients wants it, he just execute clients.py in his laptop and get the results. But in here, the Server starts distributing the data. The ip, the server using was 127.0.1.1. It is not taking the network provided ip. How to make it use the ip provided by LAN. When the clients from other computer execute clients.py file . It shows Connection refused error. Note that we are all connected in the LAN. How to solve it and make clients receive the data.

Here's the sample Client Code:

```
import socket
import os
from threading import Thread

import socket
import time

s = socket.socket()  
host = '127.0.1.1'  
port = 10016
print(host)

s.connect((host, port))
while True:
    print(s.recv(1024))
s.close() 

```

Sample Server Code:

```
import socket
import os
from threading import Thread
import thread
import threading
import time
import datetime

def listener(client, address):
    print ("Accepted connection from: ", address)
    with clients_lock:
        clients.add(client)
    try:    
        while True: 
            client.send(a)
            time.sleep(2)   

    finally:
        with clients_lock:
            clients.remove(client)
            client.close()

clients = set()
clients_lock = threading.Lock()

host = socket.gethostname()
port = 10016

s = socket.socket()
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((host,port))
s.listen(3)
th = []
print ("Server is listening for connections...")
while True:
    client, address = s.accept()
    timestamp = datetime.datetime.now().strftime("%b %d %Y,%a, %I:%M:%S %p")
    a = "Hi Steven!!!" + timestamp
    th.append(Thread(target=listener, args = (client,address)).start())
s.close()

```