         @close()
         @GlobalContext.notifySocketError()
         return false
-      if @serverAddress == "*"
-        @server?.listen @serverPort
-      else
-        @server?.listen @serverPort, @serverAddress
+      serverOptions = {}
+      serverOptions.port = @serverPort
+      if @serverAddress != "*"
+        serverOptions.host = @serverAddress
+
+      @server?.listen serverOptions, () =>
+          @GlobalContext?.notifyConsoleMessage "Listening on Address:Port " + @serverAddress + ":" + @serverPort
+          console.log "Listening on Address:Port " + @serverAddress + ":" + @serverPort
       return true
     catch e
       @GlobalContext?.notifyConsoleMessage "Error: " + "Socket Error:", e

    unless !@server
      @server.close()
      delete @server
    @GlobalContext?.notifyConsoleMessage "Closed"
    console.log("closed")

    @serverAddress = params.serverAddress

  setPort: (port) ->
    if port != @serverPort
      @serverPort = port
      if @listening()
        @close()
        @listen()


  setAddress: (address) ->
    if address != @serverAddress
      @serverAddress = address
      if @listening()
        @close()
        @listen()

  setAddressPort: (address,port) ->
    if port != @serverPort || address != @serverAddress
      @serverPort = port
      @serverAddress = address
      if @listening()
        @close()
        @listen()

  listening: ->
    return @server != undefined
