     @serverAddress = params.serverAddress
 
   setPort: (port) ->
-    @serverPort = port
-    if @listening
-      @close()
-      @listen()
+    if port != @serverPort
+      @serverPort = port
+      if @listening()
+        @close()
+        @listen()
 
 
   setAddress: (address) ->
-    @serverAddress = address
-    if @listening
-      @close()
-      @listen()
+    if address != @serverAddress
+      @serverAddress = address
+      if @listening()
+        @close()
+        @listen()
 
   setAddressPort: (address,port) ->
-    @serverPort = port
-    @serverAddress = address
-    if @listening
-      @close()
-      @listen()
+    if port != @serverPort || address != @serverAddress
+      @serverPort = port
+      @serverAddress = address
+      if @listening()
+        @close()
+        @listen()
 
   listening: ->
     return @server != undefined

    net = require "net"
    buffer = ''
    try
      @close()
      @GlobalContext?.notifyConsoleMessage "Listening on Address:Port " + @serverAddress + ":" + @serverPort
      console.log "Listening on Address:Port " + @serverAddress + ":" + @serverPort
      @server = net.createServer( (socket) =>

        socket.setEncoding('ascii');
        if !@GlobalContext.getCurrentDebugContext()
          @GlobalContext?.notifyConsoleMessage "Session initiated"

        @close()
        @GlobalContext.notifySocketError()
        return false
      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
