nameserv::server(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ’– nameserv::server β€” the manual, but make it cute

bestie, welcome to nameserv::server(n) β€” aka the Name service facility, Server page from the Name service facility docs. yes it's a Tcl thing. yes it slays. let's go ✨


🌸 SYNOPSIS 🌸

okay so first, the whole vibe in code form, verbatim, no notes:

package require Tcl 8.5 9

package require nameserv::server ?0.3.3?

package require comm

package require interp

package require logger

::nameserv::server::start

::nameserv::server::stop

::nameserv::server::active?

::nameserv::server::cget -option

::nameserv::server::configure

::nameserv::server::configure -option

::nameserv::server::configure -option value...

✨ DESCRIPTION ✨

okay so first things first: go read Name service facility, introduction before you come back here. it's giving prerequisites. do it. 🫢

This package is the server side of the name service facility β€” the thing that the client from the package nameserv comes knocking on. All the info the server needs lives in memory. There is no persistent state. it does not remember you tomorrow. it lives in the moment. main character energy honestly. πŸ’…

This service is built on top of β€” and for β€” the package comm. And listen, bestie, it has nothing to do with the Internet's Domain Name System. like, zero. different universe. If that's what you're looking for, go see Tcllib's packages dns and resolv. wrong house. πŸ™ˆ

This server supports the Core protocol feature, and since version 0.3 it also does the Search/Continuous feature. glow up. ✨


πŸ‘‘ API πŸ‘‘

The package exports five commands, and here's every single one of them:

  • ::nameserv::server::start β€” This command starts the server and causes it to listen on the configured port. From now on clients are able to connect and make requests. The result of the command is the empty string.
heads up bestie: any incoming requests will only be handled if the application the server is part of does enter an event loop after this command has been run. no event loop, no service. that's the deal. πŸ¦‹
  • ::nameserv::server::stop β€” Invoking this command stops the server and releases all information it had. Existing connections are shut down, and no new connections will be accepted any longer. The result of the command is the empty string.
  • ::nameserv::server::active? β€” This command returns a boolean value indicating the state of the server. The result will be true if the server is active, i.e. has been started, and false otherwise.
  • ::nameserv::server::cget -option β€” This command returns the currently configured value for the specified -option. The list of supported options and their meaning can be found in section OPTIONS.
  • ::nameserv::server::configure β€” In this form the command returns a dictionary of all supported options, and their current values. The list of supported options and their meaning can be found in section OPTIONS.
  • ::nameserv::server::configure -option β€” In this form the command is an alias for "::nameserv::server::cget -option". The list of supported options and their meaning can be found in section OPTIONS.
  • ::nameserv::server::configure -option value... β€” In this form the command is used to configure one or more of the supported options. At least one option has to be specified, and each option is followed by its new value. The list of supported options and their meaning can be found in section OPTIONS.
⚠️ this form can be used only if the server is not active, i.e. has not been started yet, or has been stopped. While the server is active it cannot be reconfigured. periodt. 🚫

πŸ’… OPTIONS πŸ’…

So the options here do exactly two jobs: picking the TCP port to listen on, and deciding whether to accept non-local connections or not. That's it. They are:

  • -localonly bool β€” This option specifies whether to accept only local connections (-localonly 1) or remote connections as well (-localonly 0). The default is to accept only local connections. safe queen behavior fr fr. πŸ”’
  • -port number β€” This option specifies the port the name service will listen on after it has been started. It has to be a positive integer number (> 0) not greater than 65536 (unsigned short). The initial default is the number returned by the command ::nameserv::server::common::port, as provided by the package ::nameserv::server::common.

🌈 HISTORY 🌈

  • 0.3 β€” Extended the server with the ability to perform asynchronous and continuous searches. πŸ”₯
  • 0.2 β€” Changed name of -local switch to -localonly.
  • 0.1 β€” Initial implementation of the server. the origin story. πŸŽ€

😭 BUGS, IDEAS, FEEDBACK 😭

This document, and the package it describes, will undoubtedly contain bugs and other problems. ngl, it said it itself. Please report such in the category nameserv of the Tcllib Trackers at http://core.tcl.tk/tcllib/reportlist. Please also report any ideas for enhancements you may have for either package and/or documentation. we love ideas. we love docs glow-ups. 🫢

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

✨ also note: attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. iykyk. πŸ’…

πŸ¦‹ SEE ALSO πŸ¦‹

  • nameserv::client(n)
  • nameserv::common(n)

⭐ KEYWORDS ⭐

name service, server


🌸 CATEGORY 🌸

Networking


Copyright (c) 2007-2008 Andreas Kupries <andreas_kupries@users.sourceforge.net>


and that's the whole page bestie, no cap πŸŽ€ this was tcllib version 0.3.3 of nameserv::server(n) β€” mwah, go start that server πŸ’–βœ¨

πŸ“¦ where this page comes from