   # Creates a new socket
   constructor: ->
     
-    # Holds the host currently connected to (if any)
+    # Holds the host, port and uri currently connected to (if any)
     @host = null
-    
-    # Holds the port currently connected through (if any)
     @port = NaN
+    @uri = null
     
     # Holds the actual socket
     @socket = null


  # Whether this socket is currently connected
  @getter 'connected', ->
    # TODO: Determine connection state

  # Connects to given host through given port (if any; default port is implementation specific)
  connect: (host, port=NaN) ->
    unless @connected
      @host = host
      @port = port
      # TODO: Connect socket
    return @

  # Attempts to reconnect given cached host and port
  reconnect: ->
    if not @connected and @host and @port
      @connect(@host, @port)

  
  # Disconnects this socket
  disconnect: ->
    if @connected
      @socket.close()
    return @

  # Finalizes and sends given packet
  send: (packet) ->
    if @connected
      
      console.log 'sending packet', packet
      
      packet.finalize()
      
      packet.dump()
      
      @socket.send(packet.buffer)
      
      @on.packetSend.dispatch(@, packet)
      
      return true
    
