{"id":15960998,"url":"https://github.com/nikimanoledaki/servers","last_synced_at":"2025-09-02T00:42:44.618Z","repository":{"id":103590299,"uuid":"233589169","full_name":"nikimanoledaki/servers","owner":"nikimanoledaki","description":"Learning about networked applications.","archived":false,"fork":false,"pushed_at":"2020-01-13T12:21:23.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T11:40:03.434Z","etag":null,"topics":["server"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nikimanoledaki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-01-13T12:21:00.000Z","updated_at":"2021-01-04T14:36:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"394fbbfc-82a6-42a2-a417-3f20552e1147","html_url":"https://github.com/nikimanoledaki/servers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nikimanoledaki/servers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikimanoledaki%2Fservers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikimanoledaki%2Fservers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikimanoledaki%2Fservers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikimanoledaki%2Fservers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikimanoledaki","download_url":"https://codeload.github.com/nikimanoledaki/servers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikimanoledaki%2Fservers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273213950,"owners_count":25065059,"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-09-01T02:00:09.058Z","response_time":120,"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":["server"],"created_at":"2024-10-07T15:23:10.631Z","updated_at":"2025-09-02T00:42:44.598Z","avatar_url":"https://github.com/nikimanoledaki.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Servers 1\n=========\n\n## Learn to\n\n* Learn about something by playing with a toy version\n\n## Introduction\n\nThis week we're thinking about networked applications. This means they involve clients and servers.\n\nToday we're going to build a server.\n\nWhen a developer wants to understand something, it is rare they will read reams of technical documentation. Instead, they will build or find a living example of the thing, and then play with it to see how it behaves.\n\nRemind you of any learning strategies you might have used in the past?\n\nIt's time for you to take on this approach.\n\n## Exercise 1\n\nHere's a simple server:\n\n```ruby\nrequire 'socket'\n\nserver = TCPServer.new(2345)\n\nsocket = server.accept\n\nsocket.puts \"What do you say?\"\n\nthey_said = socket.gets.chomp\n\nsocket.puts \"You said: #{they_said}. Goodbye!\"\n\nsocket.close\n```\n\nStick that in a ruby file and run it. It won't do anything — it'll just sit there.\n\nOpen up another terminal and type this:\n\n```bash\n$ telnet localhost 2345\n```\n\n\u003e You may need to run `brew install telnet` to install `telnet` first.\n\nYou should see something like:\n\n```\nTrying ::1...\nConnected to localhost.\nEscape character is '^]'.\nWhat do you say?\n```\n\nType something like this:\n\n```\nHELLO????? IS THERE ANYBODY OUT THERE??\n```\n\nHit return. What do you see?\n\n## Exercise 2\n\nTry the following challenges, in any order you like:\n\n1. At the moment the server simply quits after the first user disconnects. Make so the server stays running so that the user can reconnect.\n2. Make it so the user can stay connected and typing stuff until they type 'quit'\n3. Connect to your pair's laptop from your laptop. You'll need the network IP address of the laptop with the server on it for this. See below\n4. Create a separate `NoteList` class and make a notes app you can control over the network.\n\nOr anything you like! What do you want to know about how it works? How can you play around with this simple server to find out?\n\n### Getting the IP address\n\nOn a mac, run:\n\n```bash\n$ ifconfig en0\n```\n\nYou'll see something like this:\n\n```\nen0: flags=8863\u003cUP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST\u003e mtu 1500\n\tether 3c:15:c2:e8:1b:f0\n\tinet6 fe80::1c68:ffdb:3ec8:7caf%en0 prefixlen 64 secured scopeid 0x4\n\tinet 192.168.48.104 netmask 0xfffffc00 broadcast 192.168.51.255\n\tnd6 options=201\u003cPERFORMNUD,DAD\u003e\n\tmedia: autoselect\n\tstatus: active\n```\n\nIn this case the IP address of this computer is the thing after `inet` — `192.168.48.104`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikimanoledaki%2Fservers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikimanoledaki%2Fservers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikimanoledaki%2Fservers/lists"}