Client Server Socket Programing in Python
<p>I have the Client Server Socket program on python.
In both the Client and Server I use the loopback address.
But kindly assist how to use this code and apply on different Client Server machines
Eg (Server IP 192.168.1.4  &amp; Client IP 192.168.1.5)</p>

<pre><code># Server program

from socket import *

host = "localhost"
port = 21567
buf = 1024
addr = (host,port)

UDPSock = socket(AF_INET,SOCK_DGRAM)
UDPSock.bind(addr)

while 1:
    data,addr = UDPSock.recvfrom(buf)
    if not data:
        print "Client has exited!"
        break
    else:
        print "\nReceived message '", data,"'"


UDPSock.close()


# Client program

from socket import *


host = "localhost"
port = 21567
buf = 1024
addr = (host,port)


UDPSock = socket(AF_INET,SOCK_DGRAM)

def_msg = "===Enter message to send to server===";
print "\n",def_msg


while (1):
    data = raw_input('&gt;&gt; ')
    if not data:
        break
    else:
        if(UDPSock.sendto(data,addr)):
            print "Sending message '",data,"'....."

UDPSock.close()
</code></pre>
