I have a UDP client program .In my program i want to send a file to the server.I have created a GUI form .I use JFileChooser to select the file. after Choosing it i send the file to the UDP server. But in the server i receive the file in the Datagrampacket.After that i want to save the file in the server side. How i convert the DatagramPacket to file? And the file will be saved in the server side with the specific extension that will be sent by the client.
You can use the getDate() method to get at the bytes contained in the datagram. You'll need to collect all the bytes, and then write them to a file. The file name needs to be sent especially, maybe first thing in the transmission, separated from the actual file data by some special character.