Please guide me with the following problem. I have Server and Client java files. Client sends a file to Server, Server receives it and saves in the present working directory of Server java file. How to change the target directory in Server from current working directory?
Here is my code : Server. FileOutputStream; import java. ObjectInputStream; import java. ObjectOutputStream; import java. ServerSocket; import java. Read file name. You're already doing 1, although you may find that tweaking your buffer size up or down helps somewhat, so the main thing now is to use mulitple threads.
If I understand your scenario correctly you have many clients receiving files from a server and storing them on their local file systems. So you'll want multithreading in two places. You'll have to experiment to find the optimal number. It could be anywhere between a few threads and a few hundred. Or that might not help at all. Impossible to say without trying it in the specific situation in which it will be used. Other than that, the only thing you can do is see if the app is meeting your performance requirements, and if not, use a profiler to find bottlenecks.
Thank a lot for your support , In my requirement , All clients will transfer the files to the centralized server and save in server location. I have implemented thread concept in server side , some time some of the bytes are missing while writing in server side , now i am facing the issue.
I have implemented thread concept in server side If all clients are sending their files at the same time, I would start with something like threads reading from clients, putting into queues 1 queue per destination file and threads reading from the queues and writing to files. Since I don't know your system or your requirements at all, this is just starting point. You'll have to do some research into the relevant classes, and do some testing and tweaking on your setup to see what works best.
Probably the whole thing will be too much for anybody to want to read. You'll have better luck if you can create an SSCCE that shows the relevant parts of your code and ideally demonstrates the problem, without any extra stuff that's not directly related to the problem. Thank you very much, yes I have to go through all other thing which you have mentioned in the previous message.
I am not sure but atleast minimum 50 to Machine will send a file to server at a time. Here is my code for read and write in file : Server side : read the data from the file which have sent from client and writ in a file. Paul Clapham. If you read the documentation for the "read" method you're using, you will see that it returns -1 when it gets to the end of the stream. This was already mentioned by Rob Spoor many replies and 4 days ago.
Perhaps this time it will sink in. How can this be done? Can any one please help me in this. SaveAs Server.
FileUpload control - ASP. Does the ASPNET user account, or the account under which your process runs impersonation , have the needed privileges to write to that place? First try it out on your local machine before going to network places.
And that's completely correct since it isn't. If you use a drive letter with paths behind it you don't have to use the Server. Learn more. File transfer from client to server Ask Question. Asked 5 years, 4 months ago. Active 5 years, 4 months ago. Viewed times. Improve this question.
Mukesh Gupta Mukesh Gupta 1, 3 3 gold badges 16 16 silver badges 39 39 bronze badges. Post complete functions and structure definitions, or better complete programs that show the problem.
Add a comment. Active Oldest Votes.
0コメント