Added connection closing.  Started creation of a general receive function.