If both of machines knows the IP address of each other I would use TCP/IP protocol rather then UDP. UDP is just a kind of broadcasting:
UDP is connectionless protocol. When you a send a data or message, you don't know if it'll get there, it could get lost on the way. There may be corruption while transferring a message.
In other case (the IPs are not known) you can try it with UDP. Take a look at this example for start with it: