This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I wrote a client server program where client send request and reciev reply and the server makes connection for each client and tehn echoes the client request. I want to modify this program too send a file from client to server. How can i do that any help will be appreciated.
Hi J.N., Welcome to JavaRanch! We ain't got too many rules round these parts, but we do have our naming policy. Your display name can't be an obvious fake, like your'n. Thank you kindly for hot-footin' it over here to fix yours up! Now, on to your question. If you've written the echo server you've described, I'm not sure why you'd have a problem with transferring a file. Just open the file and spit all the data through the connection. Of course, the server has to be waiting for it. To make life easier, you might want to send the file name and file size first, and have the server be expecting that, too. Be sure to use InputStreams and OuputStreams, not Readers and Writers, to transfer the data, or your program won't work for non-textual files.
Robert Martin has been writing a series about sending compile jobs to a server - send source and get back listings and class files. It has some neat ideas about wrapping files in objects for socket transfer. See if somebody has a stack of Software Development magazines, or try http://www.sdmagazine.com/columnists/martin/ online. His ObjectMentor.com site is not responding right now, but if it comes back the articles are there, too.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi