#!/usr/bin/python
############
# UDP_Client.py 
# This program listens for
# UDP connections from UDP_Client.py
############ 

# Import socket and set up variables
import socket

My_Host = "127.0.0.1"
My_Port = 5555

# Create the socket instance
My_Socket = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )

# While loop that handles the sending of of the packets
while 1:
   
   # Send the data packet to the server
   My_Packet = raw_input( "Send Data to Server:" )
   print "\nSending packet containing:", My_Packet
   My_Socket.sendto( My_Packet, ( My_Host, My_Port ) )
   print "Packet sent\n"

   # Receive inrormation back from the server
   My_Packet, address = My_Socket.recvfrom( 1024 )
   
   print "Packet received:"
   print "From host:", address[ 0 ]
   print "Host port:", address[ 1 ]
   print "Containing:"
   print "\n" + My_Packet + "\n"



