CIT 597 More Server/Client Notes
Fall 2005, David Matuszek

More things I've learned

Can only get one file?

The Server should open the ServerSocket and leave it open. Everything else should be opened, used for one transaction, and closed.

The Client should send one file name and close everything. The Server should read one file name and close everything. It should send one file and close everything. The client should read one file and close everything.

This should solve almost all "only one file" problems.

When do you quit the Server?

Shut it down manually. Anything else (having the Client shut it down, for example) is just weird.

Can't save an RTF file?

RTFEditorKit is broken. It's not from Sun, and they take care to say so in the API. So if you try to getText on the JEditorPane when it is showing RTF, you will get null.

Simple workaround: Don't getText from the JEditorPane. You already have the String somewhere else in your code; just save that.