@@ -323,3 +323,40 @@ Unrelated function in machine module
323323 this function is not called then the default file main.py will be executed.
324324
325325 It only makes sense to call this function from within boot.py.
326+
327+ Adhoc way to control telnet/FTP server via network module
328+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
329+
330+ The ``Server `` class controls the behaviour and the configuration of the FTP and telnet
331+ services running on the WiPy. Any changes performed using this class' methods will
332+ affect both.
333+
334+ Example::
335+
336+ import network
337+ server = network.Server()
338+ server.deinit() # disable the server
339+ # enable the server again with new settings
340+ server.init(login=('user', 'password'), timeout=600)
341+
342+ .. class :: network.Server(id, ...)
343+
344+ Create a server instance, see ``init `` for parameters of initialization.
345+
346+ .. method :: server.init(\*, login=('micro', 'python'), timeout=300)
347+
348+ Init (and effectively start the server). Optionally a new ``user ``, ``password ``
349+ and ``timeout `` (in seconds) can be passed.
350+
351+ .. method :: server.deinit()
352+
353+ Stop the server
354+
355+ .. method :: server.timeout([timeout_in_seconds])
356+
357+ Get or set the server timeout.
358+
359+ .. method :: server.isrunning()
360+
361+ Returns ``True `` if the server is running, ``False `` otherwise.
362+
0 commit comments