{"id":16498017,"url":"https://github.com/dan5py/socketsc","last_synced_at":"2025-07-28T21:08:20.676Z","repository":{"id":170405761,"uuid":"610279652","full_name":"dan5py/socketsc","owner":"dan5py","description":"Python library for creating socket clients and servers.","archived":false,"fork":false,"pushed_at":"2023-03-06T13:25:32.000Z","size":55,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T16:26:14.094Z","etag":null,"topics":["client","python","server","socket"],"latest_commit_sha":null,"homepage":"https://socketsc.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dan5py.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-03-06T13:08:41.000Z","updated_at":"2023-06-16T11:44:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"e39ae6e4-eaba-469f-8f41-bb8259b9e404","html_url":"https://github.com/dan5py/socketsc","commit_stats":null,"previous_names":["dan5py/socketsc"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dan5py/socketsc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dan5py%2Fsocketsc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dan5py%2Fsocketsc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dan5py%2Fsocketsc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dan5py%2Fsocketsc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dan5py","download_url":"https://codeload.github.com/dan5py/socketsc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dan5py%2Fsocketsc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267585610,"owners_count":24111575,"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-07-28T02:00:09.689Z","response_time":68,"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":["client","python","server","socket"],"created_at":"2024-10-11T14:46:55.163Z","updated_at":"2025-07-28T21:08:20.621Z","avatar_url":"https://github.com/dan5py.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![\"socketsc\"](https://i.imgur.com/aVhWeoh.png)\n\n[![License](https://img.shields.io/pypi/l/socketsc)](https://pypi.org/project/socketsc/)\n[![Version](https://img.shields.io/pypi/v/socketsc)](https://pypi.org/project/socketsc/)\n[![Python](https://img.shields.io/pypi/pyversions/socketsc)](https://pypi.org/project/socketsc/)\n[![Documentation Status](https://readthedocs.org/projects/socketsc/badge/?version=latest)](https://socketsc.readthedocs.io/en/latest/?badge=latest)\n[![Downloads](https://img.shields.io/pypi/dm/socketsc)](https://pypi.org/project/socketsc/)\n[![Issues](https://img.shields.io/gitlab/issues/open/dan5py/socketsc)](https://gitlab.com/dan5py/socketsc/-/issues)\n\n## Installation\n\n```bash\npip install socketsc\n```\n\n## Usage\n\nSimple client and server implementation.\n\n### Server\n\n```python\nimport socketsc\n\nserver = socketsc.SocketServer((\"localhost\", 8080), address_family=socketsc.AF_INET, sock_type=socketsc.SOCK_TCP)\n\nprint(\"Server listening on port 8080\")\n\ndef on_question(socket: socketsc.ServerSocketWrapper, data):\n    print(f\"Received {data} from {socket.client_address}\")\n    socket.emit(\"answer\", \"1\")\n\nserver.on(\"question\", on_question)\nserver.serve()\n```\n\n### Client\n\n```python\nimport socketsc\n\nserver_address = (\"localhost\", 8080)\nsock = socketsc.SocketClient(server_address, address_family=socketsc.AF_INET, sock_type=socketsc.SOCK_TCP)\n\n\ndef on_answer(conn: socketsc.SocketClient, data):\n    print(f\"Server responded with {data}\")\n\n\nsock.emit(\"question\", \"0\")\nsock.on(\"answer\", on_answer)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdan5py%2Fsocketsc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdan5py%2Fsocketsc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdan5py%2Fsocketsc/lists"}