Added support for server in addition to client.

Changed the public interface to make more sense for the dual mode.
This will obviously break some code that worked on earlier versions.
fix call to send (bug)
new version.

add rest support.