{"id":49108333,"url":"https://github.com/muhammadimran-dev/covid_tcp_server","last_synced_at":"2026-04-21T03:01:55.254Z","repository":{"id":170684996,"uuid":"280337600","full_name":"muhammadimran-dev/Covid_TCP_Server","owner":"muhammadimran-dev","description":"Covid TCT Server through netcat","archived":false,"fork":false,"pushed_at":"2021-02-08T14:48:15.000Z","size":15,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-21T17:56:14.314Z","etag":null,"topics":["client-server","covid","covid-19","covid19","golang","json","server","tcp","tcp-server"],"latest_commit_sha":null,"homepage":"","language":"Go","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/muhammadimran-dev.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}},"created_at":"2020-07-17T05:45:17.000Z","updated_at":"2021-02-08T14:48:19.000Z","dependencies_parsed_at":"2024-01-27T04:59:12.589Z","dependency_job_id":null,"html_url":"https://github.com/muhammadimran-dev/Covid_TCP_Server","commit_stats":null,"previous_names":["muhammadimran-dev/covid_tcp_server","imrankhalid-tech/covid_tcp_server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/muhammadimran-dev/Covid_TCP_Server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammadimran-dev%2FCovid_TCP_Server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammadimran-dev%2FCovid_TCP_Server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammadimran-dev%2FCovid_TCP_Server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammadimran-dev%2FCovid_TCP_Server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muhammadimran-dev","download_url":"https://codeload.github.com/muhammadimran-dev/Covid_TCP_Server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammadimran-dev%2FCovid_TCP_Server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32074812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T02:38:07.213Z","status":"ssl_error","status_checked_at":"2026-04-21T02:38:06.559Z","response_time":128,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-server","covid","covid-19","covid19","golang","json","server","tcp","tcp-server"],"created_at":"2026-04-21T03:01:25.590Z","updated_at":"2026-04-21T03:01:55.248Z","avatar_url":"https://github.com/muhammadimran-dev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Covid_TCP_Server\nCovid TCT Server through netcat\n\n// This program implements a Covid lookup service\n// over TCP or Unix Data Socket. It loads CSV Covid Dataset\n// information using package lib (see above) and uses a simple\n// text-based protocol to interact with the client and send\n// the data.\n//\n// Clients send covid dataset search requests as a textual command in the form:\n// Open new Terminal:\n// $ go run serertxt.go\n// Open another Terminal:\n// $ nc localhost 4040\n// $ {\"query\": {\"region\": \"Sindh\"}}\n// $ {\"query\": {\"date\": \"4/4/2020\"}}\n// for query It's mendatory to follow the given JSOn Structure as it is given above.\n//\n// When the server receives the request, it is parsed and is then used\n// to search the list of covid Dataset. The search result is then printed\n// JSON Format dataset to the client.\n//\n// Focus:\n// This version of the server uses TCP sockets (or UDS) to implement a simple\n// text-based application-level protocol. There are no streaming strategy\n// employed for the read/write operations. Buffers are read in one shot\n// creating opportunities for missing data during read.\n//\n// Testing:\n// Netcat or telnet can be used to test this server by connecting and\n// sending command using the format described above.\n//\n// Usage: server [options]\n// options:\n//   -e host endpoint, default \":4040\"\n//   -n network protocol [tcp,unix], default \"tcp\"\n\n\n                                    Here is complete overview of this tcp server\n            \n            \n(Golang): This tasks is designed to help you work with concepts frequently used in backend systems development. \n\n## Programming Language\n[Go v1.14](https://golang.org/)\n\n\n## Task\n\nWrite a **TCP Server** that loads dataset from a **CSV file** and provide interface to query the dataset. TCP server will expose port **4040**.\n\n\n### Dataset\n\nYou will be required to download **Corona Virus Pakistan Dataset 2020** from the **OpenData.com.pk**, convert the dataset into a CSV file and use this file to load data into the server.\n\n- Download `COVID_FINAL_DATA.xlsx` from [OpenData.com.pk](https://opendata.com.pk/dataset/corona-virus-pakistan-dataset-2020)\n- Convert first sheet \"TimeSeries_KeyIndicators\" into a CSV file\n- Place the CSV file into the repository\n\nFollowing columns are required in CSV:\n- Cumulative Test Positive\n- Cumulative Tests Performed\n- Date\n- Discharged\n- Expired\n- Admitted\n- Region\n\n### Server Communication\n\nUser should be able to connect to the server using **NetCat** `nc localhost 4040` command on Linux/Unix based systems.\n\nOnce connected to TCP, user should be able communicate with the application by sending queries in JSON format.\n\n```\n{\n\t\"query\": {\n\t\t\"region\": \"Sindh\"\n\t}\n}\n```\n\n```\n{\n\t\"query\": {\n\t\t\"date\": \"20/3/2020\"\n\t}\n}\n```\n\nUser can query data based on two fields: Region and Date.\n\nIn response, server will return a **list** of records that will match query. An individual record's JSON format will look like:\n\n```\n{\n   \"date\": \"2020-03-11\",\n   \"positive\": 2,\n   \"tests\": 171,\n   \"expired\": 0,\n   \"admitted\": 13,\n   \"discharged\": 0,\n   \"region\": \"Sindh\"\n}\n```\n\n\n## Query Examples\n\n```\n\u003e nc localhost 4040\n\u003e {\"query\": {\"region\": \"Sindh\"}}\n\u003e {\"response\": [\n   {\n\t   \"date\": \"11/03/2020\",\n\t   \"positive\": 2,\n\t   \"tests\": 171,\n\t   \"expired\": 0,\n\t   \"admitted\": 13,\n\t   \"discharged\": 0,\n\t   \"region\": \"Sindh\"\n   },\n   {\n\t   \"date\": \"12/3/2020\",\n\t   \"positive\": 14,\n\t   \"tests\": 324,\n\t   \"expired\": 0,\n\t   \"admitted\": 13,\n\t   \"discharged\": 0,\n\t   \"region\": \"Sindh\"\n   },\n   {\n\t   \"date\": \"2020-03-13\",\n\t   \"positive\": 43,\n\t   \"tests\": 324,\n\t   \"expired\": 0,\n\t   \"admitted\": 12,\n\t   \"discharged\": 0,\n\t   \"region\": \"Sindh\"\n   }\n  ]}\n```\n\n```\n\u003e nc localhost 4040\n\u003e {\"query\": {\"date\": \"2020-03-20\"}}\n\u003e {\"response\": [\n   {\n\t   \"date\": \"2020-03-20\",\n\t   \"positive\": 2,\n\t   \"tests\": 171,\n\t   \"expired\": 0,\n\t   \"admitted\": 13,\n\t   \"discharged\": 0,\n\t   \"region\": \"Sindh\"\n   },\n   {\n\t   \"date\": \"2020-03-20\",\n\t   \"positive\": 14,\n\t   \"tests\": 324,\n\t   \"expired\": 0,\n\t   \"admitted\": 13,\n\t   \"discharged\": 0,\n\t   \"region\": \"Punjab\"\n   },\n   {\n\t   \"date\": \"2020-03-20\",\n\t   \"positive\": 43,\n\t   \"tests\": 324,\n\t   \"expired\": 0,\n\t   \"admitted\": 12,\n\t   \"discharged\": 0,\n\t   \"region\": \"KP\"\n   }\n  ]}\n```\n\n\n\n## Learning Resources\n\n[Effective Go](https://golang.org/doc/effective_go.html)\n\n[Reading a simple CSV in Go](https://medium.com/@ankurraina/reading-a-simple-csv-in-go-36d7a269cecd)\n\n[Read a CSV File into a Struct](https://golangcode.com/how-to-read-a-csv-file-into-a-struct/)\n\n[Go by Example: JSON](https://gobyexample.com/json)\n\n[Network Programming with Go: A TCP Server with a Custom Protocol](https://www.youtube.com/watch?v=yW1ltZidh7g)\n\n[How to Use Netcat Commands: Examples and Cheat Sheets](https://www.varonis.com/blog/netcat-commands/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhammadimran-dev%2Fcovid_tcp_server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuhammadimran-dev%2Fcovid_tcp_server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhammadimran-dev%2Fcovid_tcp_server/lists"}