aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes transfer files from client to server using the UDP protocol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "transfer files from client to server using the UDP protocol" Watch "transfer files from client to server using the UDP protocol" New topic
Author

transfer files from client to server using the UDP protocol

Tung Xuan
Greenhorn

Joined: Apr 16, 2012
Posts: 9
I am learning java, I am doing file transfer using UDP protocol, my problem is I can not create a new file server, please help me
this is my code
client

server

someone can help me how to transfer any file (jpg, avi, doc, etc.) from client to server??
I thank you very much
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

What exact problem are you having? Note that ItDoesntWorkIsUseless(←click).

And why are you using UDP for file transfer? Are you willing to accept chunks going missing or arriving out of order? Or are you going to implement sequencing and retransmission--which TCP give you for free?
Tung Xuan
Greenhorn

Joined: Apr 16, 2012
Posts: 9
My problem is when the client read the file put in the package sent to the server, the server receives the packet and create the same file in client but nothing is written to the file.
I use UDP because it is my homework, I have the idea that every time the client transfer packet will numbered order packets if the packet is missing or arriving out of order, the client will send back
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Seems like it's time to do some debugging. That starts with observing what your program is doing. Add print statements in your server so you can see which bytes you're receiving, how big the packets are, and how often the loop body is being executed. Likewise, add print statements to the client so that you can verify what it's sending.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: transfer files from client to server using the UDP protocol