{"id":21207324,"url":"https://github.com/cacilhas/sssjit","last_synced_at":"2026-02-24T20:42:24.742Z","repository":{"id":119028684,"uuid":"164507012","full_name":"cacilhas/sssjit","owner":"cacilhas","description":"A reimplementation of SSS powered by MoonScript and LuaJIT.","archived":false,"fork":false,"pushed_at":"2021-10-07T20:28:10.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-04T06:18:43.102Z","etag":null,"topics":["luajit","moonscript","socket"],"latest_commit_sha":null,"homepage":null,"language":"MoonScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cacilhas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-07T22:28:51.000Z","updated_at":"2021-10-07T20:28:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"fd77187a-b0cd-48f6-bc1e-2ba4dacda66c","html_url":"https://github.com/cacilhas/sssjit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cacilhas/sssjit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cacilhas%2Fsssjit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cacilhas%2Fsssjit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cacilhas%2Fsssjit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cacilhas%2Fsssjit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cacilhas","download_url":"https://codeload.github.com/cacilhas/sssjit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cacilhas%2Fsssjit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271989975,"owners_count":24854701,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["luajit","moonscript","socket"],"created_at":"2024-11-20T20:58:25.266Z","updated_at":"2026-02-24T20:42:19.704Z","avatar_url":"https://github.com/cacilhas.png","language":"MoonScript","readme":"# LuaJIT-powered Simple Stupid Socket\n\nA reimplementation of [SSS](https://github.com/cacilhas/sss/) powered by\n[MoonScript](http://moonscript.org/) and [LuaJIT](http://luajit.org).\n\n\n## Install\n\n```\nsh$ make\nsh$ make test\nsh$ sudo make install\n```\n\nBefore `make install`, you can check if it’s ok by running:\n\n```\nsh$ make echoserver\n```\n\nAnd:\n\n```\nsh$ telnet localhost 32000\nTrying 127.0.0.1...\nConnected to localhost.\nEscape character is '^]'.\ntest\ntest\nConnection closed by foreign host.\nsh$\n```\n\n\n## Use\n\n```\n#!moonscript\n\nsss = assert require \"sss\"\nsocket = sss.socket!\n```\n\nThe `socket` function receives three parameters:\n\n1. domain: from `sss.AF` table, default `sss.AF.inet`\n2. type: from `sss.SOCK` table, default `sss.SOCK.stream`\n3. protocol: integer or string, see `/etc/protocols`, default 0\n\nThe socket object accepts the following messages:\n\n* `socket.close!` – closes the socket.\n\n* `socket.connect address` – connects to the address. The address can be:\n\t- a table with the keys `host` and `port`\n\t- an address object, got from `sss.tocaddress t`\n\n* `socket.bind address` – binds to the address. Adress as above.\n\n* `socket.listen backlog` – like C `listen` function.\n\n* `socket.accept!` – accepts new connections, returns the client socket and the\n  C address.\n\n* `socket.receive!` – receives and returns one line from remote peer.\n\n* `socket.recv n` – receives `n` bytes from remote peer. Default 1024.\n\n* `socket.send data` – sends data to remote peer.\n\n* `socket.sendto data, address` – like C `sendto` function.\n\n* `socket.setopt name, value` – sets socket option, value must be a `cdata`.\n\n* `socket.getopt name` – gets socket option value, returns\n  `cdata\u003cunsgined char[?]\u003e` and the length in bytes.\n\n* `socket.settimeout tmo` – sets the receiving and/or sending timeout. `tmo`\n  can be a number, or a table containing the keys `send` and `receive`.\n\n\nAnother useful functions:\n\n* `tocaddress addr` – converts a table to C address.\n* `toladdress addr` – converts a C address to table.\n\n\n### The tables\n\n* `sss.AF`: contains the socket address families.\n* `sss.SOCK`: contains the socket types.\n* `sss.SO`: contains the socket options.\n\nTo see the content:\n\n```\n#!moonscript\n\ntable.foreach sss.AF, print\n```\n\n\n### The sample echo server\n\n```\n#!moonscript\n\n#!/usr/bin/env moon\n\nsss = assert require \"sss\"\n\ns = with sss.socket!\n    \\reuseaddr!\n    \\bind\n        host: \"*\"\n        port: 32000\n    \\listen!\n\nwhile true\n    with s\\accept!\n        got = \\receive!\n        \\send got\n        \\close!\n```\n\n\n## License\n\n[The BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause)\n\nCopyright © 2015, Rodrigo Cacilhας \\\u003cbatalema@cacilhas.info\u003e\n\nAll rights reserved.\n\n\n## Author\n\n[ℜodrigo Arĥimedeς ℳontegasppa ℭacilhας](mailto:batalema@cacilhas.info)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcacilhas%2Fsssjit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcacilhas%2Fsssjit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcacilhas%2Fsssjit/lists"}