UDP, which is used by DatagramSocket, is not the best option for sending files, as UDP does not guarantee arrival nor order. TCP, which is used by Socket, does.
Should you still need to do it,
you should create a DatagramPacket with the contents as a byte[] from the text file, then send that DatagramPacket. If the file is too large you need to send multiple DatagramPackets but as said before, you will be very lucky if the packets arrive in the same order as you send them.