1. Server (server. py)
What the server must do is:
1. Create a socket object Import Socket
S = Socket. socket (socket. af_inet, socket. sock_dgram)
2. Bind a port S. BIND (("",8081))
3. Accept Messages from the client
code highlighting produced by actipro codehighlighter (freeware)
http://www.CodeHighlighter.com/
--> while true:
# receive up to 1,024 bytes in a datax
data, ADDR = S. recvfrom ( 1024 )
Print " received: " , data, " from " , ADDR
2. Client. py
what the client must do is:
1. Create a socket object.
code highlighting produced by actipro codehighlighter (freeware)
http://www.CodeHighlighter.com/
--> Import socket
S = socket. socket (socket. af_inet, socket. sock_dgram)
2. send messages to the specified port of a server. Because UDP is used, if the server does not receive the packet, it will discard the packet. Port= 8081
Host= "Localhost"
WhileTrue:
MSG=Raw_input ()
S. sendto (MSG, (host, Port ))
Iii. Try running