0

I have been working on the development of a simple server - client application with the use of sockets. So far, both sides use a BufferedReader for the input stream and a PrintWriter for the output stream.

This works great so far as I am able to send simple messages from the client to the server and vice versa. I have tried to implement an additional functionality which allows the server and the client to exchange files between them. I've gone through some online tutorials and from what I've gathered using a DataInputStream and DataOutputStream is probably ideal for that purpose.

My question is, what would the most appropriate way to implement this be, so that my server and client are able to exchange both messages and files?

Josh3248
  • 3
  • 5
  • 1
    Your question is probably too broad, but I would have a common library (in Java) that did the serialization/marshaling and have both client and server use the same common library. This makes a more complicated project structure but in the end I think will be worth the effort. – markspace Mar 11 '18 at 20:46
  • You can use Java RMI for example https://en.wikipedia.org/wiki/Java_remote_method_invocation – quant Mar 11 '18 at 20:48
  • @quant Not for transferring files, unless you're a masochist. – user207421 Mar 12 '18 at 01:21

0 Answers0