{"id":22959545,"url":"https://github.com/issamansur/chatonbasesocket","last_synced_at":"2025-08-13T05:32:06.638Z","repository":{"id":200377887,"uuid":"705350738","full_name":"issamansur/ChatOnBaseSocket","owner":"issamansur","description":"Simple c++ project for testing sockets with ws2_32.lib","archived":false,"fork":false,"pushed_at":"2023-10-17T14:07:14.000Z","size":31,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-10-17T18:41:47.514Z","etag":null,"topics":["callab","collaborate","cpp","hacktoberfest","learn","socket","winsock","wsa"],"latest_commit_sha":null,"homepage":"","language":"C++","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/issamansur.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}},"created_at":"2023-10-15T19:08:12.000Z","updated_at":"2023-10-20T14:29:27.390Z","dependencies_parsed_at":"2023-10-16T18:54:58.941Z","dependency_job_id":"b863cb38-1f2f-4ae2-a843-5f3adcd91590","html_url":"https://github.com/issamansur/ChatOnBaseSocket","commit_stats":null,"previous_names":["issamansur/chatonbasesocket"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/issamansur%2FChatOnBaseSocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/issamansur%2FChatOnBaseSocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/issamansur%2FChatOnBaseSocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/issamansur%2FChatOnBaseSocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/issamansur","download_url":"https://codeload.github.com/issamansur/ChatOnBaseSocket/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229737859,"owners_count":18116524,"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","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":["callab","collaborate","cpp","hacktoberfest","learn","socket","winsock","wsa"],"created_at":"2024-12-14T18:19:00.434Z","updated_at":"2024-12-14T18:20:11.235Z","avatar_url":"https://github.com/issamansur.png","language":"C++","readme":"# ChatOnBaseSocket\n\n## The principle of operation:\n1. Initialize WSA - `WSAStartup()`\n2. Create a socket - `socket()`\n3. Bind the socket - `bind()`\n4. Listen on the socket - `listen()`\n5. Accept a connection - `accept()`/`connect()`\n6. Send and receive data - `recv()`, `recvfrom`/`send()`, `sendto()`\n7. Disconnect - `closesocket()`\n\n## From abstraction to realization:\n\n### Preparing\nBefore you develop Windows Sockets programs within Visual Studio, you must include the `ws2_32.lib` library within your Project.\n\nCreate a new `C++ Console Project` and follow the steps belows:\n- Select the `Project` menu\n- Select the `Properties` (by default `Alt+F7`)\n- In opened window in left menu select `Linker`\n- In submenu select `Input`\n- In main view select `Additional Dependencies` and `Edit...`\n- In opened subwindow in input print `ws2_32.lib` and click `OK`\n- Click `Apply` and then `OK`\n- Done!\n\n## Tasks\n\n### Main\n- [x] Connect `Client` with `Server`\n- [x] Add args for cli (Command line)\n- [x] `Client` can send message with size more than `bufferSize`\n- [x] `Client` can send more than one message\n- [x] `Server` can respond on `Client`'s message\n\n- [x] `Server` can accept and listen more than one `Client`\n- [x] `Server` can receive message from one `Client` and MAYBE send this message to others `Client`s \n\n\n### Additional\n- [x] Change splitting: vector\u003cstring\u003e -\u003e char* (for optimize)\n- [x] Add maximum count of `Client`s\n- [ ] Every `Client` must have unique username\n- [x] Add command `/exit` to leave chat\n- [ ] Add command `/private [username]` to send private message\n- [x] Add formatted output (BETA)\n\n## Example\n\n### Server\n```\nIP ADDRESS: 127.0.0.1\nPORT: 55555\n\nThe Winsock dll found!\nThe status: Running\nsocket() is OK!\nbind() is OK!\nStart listening on port: 55555\nAccepted connection 1/10\nAccepted connection 2/10\n[2023-11-08 22:10:19] user2: hi, user1\n[2023-11-08 22:10:32] user1: hello, user2\n[2023-11-08 22:10:50] user1: how are u?\nClient has terminated the connection\nClient's socket was closed 1/10\nClient has terminated the connection\nClient's socket was closed 0/10\n```\n\n### Client1\n```\nIP ADDRESS: 127.0.0.1\nPORT: 55555\n\nThe Winsock dll found!\nThe status: Running\nsocket() is OK!\nClient connect() is OK!\nEnter your username (5-20 symbols): user1\n[2023-11-08 22:10:19] user2: hi, user1\n[2023-11-08 22:10:32] user1: hello, user2\n[2023-11-08 22:10:50] user1: how are u?\n\n...\n\nuser1 (YOU) \u003e /exit\nClient closed the connection.\n```\n\n### Client1\n```\nIP ADDRESS: 127.0.0.1\nPORT: 55555\n\nThe Winsock dll found!\nThe status: Running\nsocket() is OK!\nClient connect() is OK!\nEnter your username (5-20 symbols): user2\n[2023-11-08 22:10:19] user2: hi, user1\n[2023-11-08 22:10:32] user1: hello, user2\n[2023-11-08 22:10:50] user1: how are u?\n\n...\n\nuser1 (YOU) \u003e /exit\nClient closed the connection.\n```\n\n### Interesting links for updates\n\n- [Formatting output](https://ru.stackoverflow.com/questions/1243530/%D0%9A%D0%B0%D0%BA-%D0%BE%D0%B4%D0%BD%D0%BE%D0%B2%D1%80%D0%B5%D0%BC%D0%B5%D0%BD%D0%BD%D0%BE-%D0%B2%D0%B2%D0%BE%D0%B4%D0%B8%D1%82%D1%8C-%D0%B8-%D0%B2%D1%8B%D0%B2%D0%BE%D0%B4%D0%B8%D1%82%D1%8C-%D0%B4%D0%B0%D0%BD%D0%BD%D1%8B%D0%B5-%D0%B2-%D0%BA%D0%BE%D0%BD%D1%81%D0%BE%D0%BB%D1%8C-python?ysclid=lomiqw8bly490441757)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fissamansur%2Fchatonbasesocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fissamansur%2Fchatonbasesocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fissamansur%2Fchatonbasesocket/lists"}