I have an client server application. in some cases I want to send files between server and client. But I don't know how to do it. Can I do it using socket programming? the files that I want to send can be documents, media files, text files, pdf files, ect.... . Actually I want to send a file across the network. please help me.
My application is not a web application. I need to implement this file sending on a LAN. If I can use socket programming to do this, then how can I do it? If you have an example code please post it or if you can give me a link please post them. I am new for this socket programming side. Please help me.
Searching for "java socket tutorial" should find the relevant chapter of the Sun Java Tutorial. It contains an example of a pair of standalone client/server applications that communicate via sockets.
My application is not a web application. I need to implement this file sending on a LAN. If I can use socket programming to do this, then how can I do it? If you have an example code please post it or if you can give me a link please post them. I am new for this socket programming side. Please help me.
Thank you.
It doesn't matter if it's a web application. As long as the network is TCP, you can use a FTP server and client as was suggested. For a project, I wrote a DOS FTP server in Java and a DOS client in Pascal that was used to replace file transfer vis modem in an application. The client was not a web application.
Below is a very basic sample of using sockets for transfering files of any type over the network, but it could give you general idea. Output file is written to current server working directory and no additional checking is provided. So if file of the same name already exists, it would be overwritten.
Server.java
and Client.java
Post by:autobot
I suggest huckleberry pie. But the only thing on the gluten free menu is this tiny ad:
a bit of art, as a gift, the permaculture playing cards