             Socket.dictionary.removeValueForKey(uv_stream_ptr(handle))
         }
     }
+    
+    public static func onTimeout( msecs : UInt64, callback : ((uv_timer_ptr)->()) ) {
+        
+        let timer : Timer = Timer()
+        timer.event.onTimeout = callback
+        Timer.start(timer.timerhandle, timeout: msecs, count: 0)
+    }
         
 }
 

        }
        
        Tcp.bind(self.server.tcpHandle, address : self.ip, port: self.port)
        
        Tcp.listen(self.server.tcpHandle)
    
        uv_run(uv_default_loop(), UV_RUN_DEFAULT)
        
    }
    
}
        
        Stream.doWrite(uv_buf_const_ptr(buffer), handle: handle)
        
        Socket.onTimeout(100){ [unowned self]
            _ in
            self.close()
        }
    }
    
    public func close() {
    
        Handle.close(uv_handle_ptr(handle))
    }
    
    public func setKeepAlive(msecs: UInt32) {
