autosocket function

Returns a socket to the last opened database