{"id":20936899,"url":"https://github.com/hakimkartik/course-registration","last_synced_at":"2026-04-16T04:33:53.279Z","repository":{"id":251524830,"uuid":"588823551","full_name":"hakimkartik/course-registration","owner":"hakimkartik","description":"A TCP/UDP backend server to handle student course registration, written in C","archived":false,"fork":false,"pushed_at":"2023-01-14T05:57:55.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-19T20:17:33.178Z","etag":null,"topics":["c","cli","tcp-client","tcp-server","terminal-based","udp-server"],"latest_commit_sha":null,"homepage":"","language":"C++","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/hakimkartik.png","metadata":{"files":{"readme":"readme.html","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":"2023-01-14T05:56:30.000Z","updated_at":"2024-08-03T17:19:20.000Z","dependencies_parsed_at":"2024-08-03T18:29:08.868Z","dependency_job_id":null,"html_url":"https://github.com/hakimkartik/course-registration","commit_stats":null,"previous_names":["hakimkartik/course-registration"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakimkartik%2Fcourse-registration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakimkartik%2Fcourse-registration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakimkartik%2Fcourse-registration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakimkartik%2Fcourse-registration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hakimkartik","download_url":"https://codeload.github.com/hakimkartik/course-registration/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243330325,"owners_count":20274039,"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":["c","cli","tcp-client","tcp-server","terminal-based","udp-server"],"created_at":"2024-11-18T22:29:20.210Z","updated_at":"2025-12-29T04:43:11.665Z","avatar_url":"https://github.com/hakimkartik.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\n\u003chead\u003e\n  \u003cmeta charset=\"utf-8\"\u003e\n  \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n  \u003ctitle\u003ereadme\u003c/title\u003e\n  \u003clink rel=\"stylesheet\" href=\"https://stackedit.io/style.css\" /\u003e\n\u003c/head\u003e\n\n\u003cbody class=\"stackedit\"\u003e\n  \u003cdiv class=\"stackedit__html\"\u003e\u003ch1 id=\"ee450-project\"\u003eEE450 Project\u003c/h1\u003e\n\u003cpre\u003e\u003ccode\u003e\n\t\t\t\tName: Kartik Hakim\n\n\t\t\t\tUSC ID: 9520-8829-28\n\n\t\t\t\tExtra Credit Section : Done\n\n\u003c/code\u003e\u003c/pre\u003e\n\u003ch1 id=\"project-flow-chart\"\u003eProject flow chart:\u003c/h1\u003e\n\u003cpre class=\" language-mermaid\"\u003e\u003csvg id=\"mermaid-svg-v0g0KnBpUUrk47XC\" width=\"100%\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" height=\"256.15625\" style=\"max-width: 679.5625px;\" viewBox=\"0 0 679.5625 256.15625\"\u003e\u003cstyle\u003e#mermaid-svg-v0g0KnBpUUrk47XC{font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-size:16px;fill:#000000;}#mermaid-svg-v0g0KnBpUUrk47XC .error-icon{fill:#552222;}#mermaid-svg-v0g0KnBpUUrk47XC .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-v0g0KnBpUUrk47XC .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-v0g0KnBpUUrk47XC .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-v0g0KnBpUUrk47XC .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-v0g0KnBpUUrk47XC .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-v0g0KnBpUUrk47XC .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-v0g0KnBpUUrk47XC .marker{fill:#666;stroke:#666;}#mermaid-svg-v0g0KnBpUUrk47XC .marker.cross{stroke:#666;}#mermaid-svg-v0g0KnBpUUrk47XC svg{font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-v0g0KnBpUUrk47XC .label{font-family:\"trebuchet ms\",verdana,arial,sans-serif;color:#000000;}#mermaid-svg-v0g0KnBpUUrk47XC .cluster-label text{fill:#333;}#mermaid-svg-v0g0KnBpUUrk47XC .cluster-label span{color:#333;}#mermaid-svg-v0g0KnBpUUrk47XC .label text,#mermaid-svg-v0g0KnBpUUrk47XC span{fill:#000000;color:#000000;}#mermaid-svg-v0g0KnBpUUrk47XC .node rect,#mermaid-svg-v0g0KnBpUUrk47XC .node circle,#mermaid-svg-v0g0KnBpUUrk47XC .node ellipse,#mermaid-svg-v0g0KnBpUUrk47XC .node polygon,#mermaid-svg-v0g0KnBpUUrk47XC .node path{fill:#eee;stroke:#999;stroke-width:1px;}#mermaid-svg-v0g0KnBpUUrk47XC .node .label{text-align:center;}#mermaid-svg-v0g0KnBpUUrk47XC .node.clickable{cursor:pointer;}#mermaid-svg-v0g0KnBpUUrk47XC .arrowheadPath{fill:#333333;}#mermaid-svg-v0g0KnBpUUrk47XC .edgePath .path{stroke:#666;stroke-width:1.5px;}#mermaid-svg-v0g0KnBpUUrk47XC .flowchart-link{stroke:#666;fill:none;}#mermaid-svg-v0g0KnBpUUrk47XC .edgeLabel{background-color:white;text-align:center;}#mermaid-svg-v0g0KnBpUUrk47XC .edgeLabel rect{opacity:0.5;background-color:white;fill:white;}#mermaid-svg-v0g0KnBpUUrk47XC .cluster rect{fill:hsl(210,66.6666666667%,95%);stroke:#26a;stroke-width:1px;}#mermaid-svg-v0g0KnBpUUrk47XC .cluster text{fill:#333;}#mermaid-svg-v0g0KnBpUUrk47XC .cluster span{color:#333;}#mermaid-svg-v0g0KnBpUUrk47XC div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-size:12px;background:hsl(-160,0%,93.3333333333%);border:1px solid #26a;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-v0g0KnBpUUrk47XC:root{--mermaid-font-family:\"trebuchet ms\",verdana,arial,sans-serif;}#mermaid-svg-v0g0KnBpUUrk47XC flowchart{fill:apa;}\u003c/style\u003e\u003cg\u003e\u003cg class=\"output\"\u003e\u003cg class=\"clusters\"\u003e\u003c/g\u003e\u003cg class=\"edgePaths\"\u003e\u003cg class=\"edgePath LS-B LE-A\" id=\"L-B-A\" style=\"opacity: 1;\"\u003e\u003cpath class=\"path\" d=\"M69.015625,128.078125L167.20703125,128.078125L265.3984375,128.078125\" marker-end=\"url(https://stackedit.io/app#arrowhead9)\" style=\"fill:none\"\u003e\u003c/path\u003e\u003cdefs\u003e\u003cmarker id=\"arrowhead9\" viewBox=\"0 0 10 10\" refX=\"9\" refY=\"5\" markerUnits=\"strokeWidth\" markerWidth=\"8\" markerHeight=\"6\" orient=\"auto\"\u003e\u003cpath d=\"M 0 0 L 0 0 L 0 0 z\" style=\"fill: #333\"\u003e\u003c/path\u003e\u003c/marker\u003e\u003c/defs\u003e\u003c/g\u003e\u003cg class=\"edgePath LS-A LE-C\" id=\"L-A-C\" style=\"opacity: 1;\"\u003e\u003cpath class=\"path\" d=\"M318.33767606522616,104.71875L365.953125,31.359375L465.5234375,31.359375L565.09375,31.359375L593.94140625,31.359375\" marker-end=\"url(https://stackedit.io/app#arrowhead10)\" style=\"fill:none\"\u003e\u003c/path\u003e\u003cdefs\u003e\u003cmarker id=\"arrowhead10\" viewBox=\"0 0 10 10\" refX=\"9\" refY=\"5\" markerUnits=\"strokeWidth\" markerWidth=\"8\" markerHeight=\"6\" orient=\"auto\"\u003e\u003cpath d=\"M 0 0 L 0 0 L 0 0 z\" style=\"fill: #333\"\u003e\u003c/path\u003e\u003c/marker\u003e\u003c/defs\u003e\u003c/g\u003e\u003cg class=\"edgePath LS-A LE-D\" id=\"L-A-D\" style=\"opacity: 1;\"\u003e\u003cpath class=\"path\" d=\"M340.953125,128.078125L365.953125,128.078125L465.5234375,128.078125L565.09375,128.078125L590.09375,128.078125\" marker-end=\"url(https://stackedit.io/app#arrowhead11)\" style=\"fill:none\"\u003e\u003c/path\u003e\u003cdefs\u003e\u003cmarker id=\"arrowhead11\" viewBox=\"0 0 10 10\" refX=\"9\" refY=\"5\" markerUnits=\"strokeWidth\" markerWidth=\"8\" markerHeight=\"6\" orient=\"auto\"\u003e\u003cpath d=\"M 0 0 L 0 0 L 0 0 z\" style=\"fill: #333\"\u003e\u003c/path\u003e\u003c/marker\u003e\u003c/defs\u003e\u003c/g\u003e\u003cg class=\"edgePath LS-A LE-E\" id=\"L-A-E\" style=\"opacity: 1;\"\u003e\u003cpath class=\"path\" d=\"M318.33767606522616,151.4375L365.953125,224.796875L465.5234375,224.796875L565.09375,224.796875L590.15625,224.796875\" marker-end=\"url(https://stackedit.io/app#arrowhead12)\" style=\"fill:none\"\u003e\u003c/path\u003e\u003cdefs\u003e\u003cmarker id=\"arrowhead12\" viewBox=\"0 0 10 10\" refX=\"9\" refY=\"5\" markerUnits=\"strokeWidth\" markerWidth=\"8\" markerHeight=\"6\" orient=\"auto\"\u003e\u003cpath d=\"M 0 0 L 0 0 L 0 0 z\" style=\"fill: #333\"\u003e\u003c/path\u003e\u003c/marker\u003e\u003c/defs\u003e\u003c/g\u003e\u003c/g\u003e\u003cg class=\"edgeLabels\"\u003e\u003cg class=\"edgeLabel\" transform=\"translate(167.20703125,128.078125)\" style=\"opacity: 1;\"\u003e\u003cg transform=\"translate(-73.19140625,-26.71875)\" class=\"label\"\u003e\u003crect rx=\"0\" ry=\"0\" width=\"146.3828125\" height=\"53.4375\"\u003e\u003c/rect\u003e\u003cforeignObject width=\"146.3828125\" height=\"53.4375\"\u003e\u003cdiv xmlns=\"http://www.w3.org/1999/xhtml\" style=\"display: inline-block; white-space: nowrap;\"\u003e\u003cspan id=\"L-L-B-A\" class=\"edgeLabel L-LS-B' L-LE-A\"\u003etcpServerPort:25928\u003cbr\u003eudpClientPort:24928\u003c/span\u003e\u003c/div\u003e\u003c/foreignObject\u003e\u003c/g\u003e\u003c/g\u003e\u003cg class=\"edgeLabel\" transform=\"translate(465.5234375,31.359375)\" style=\"opacity: 1;\"\u003e\u003cg transform=\"translate(-74.5703125,-13.359375)\" class=\"label\"\u003e\u003crect rx=\"0\" ry=\"0\" width=\"149.140625\" height=\"26.71875\"\u003e\u003c/rect\u003e\u003cforeignObject width=\"149.140625\" height=\"26.71875\"\u003e\u003cdiv xmlns=\"http://www.w3.org/1999/xhtml\" style=\"display: inline-block; white-space: nowrap;\"\u003e\u003cspan id=\"L-L-A-C\" class=\"edgeLabel L-LS-A' L-LE-C\"\u003eudpServerPort:21928\u003c/span\u003e\u003c/div\u003e\u003c/foreignObject\u003e\u003c/g\u003e\u003c/g\u003e\u003cg class=\"edgeLabel\" transform=\"translate(465.5234375,128.078125)\" style=\"opacity: 1;\"\u003e\u003cg transform=\"translate(-74.5703125,-13.359375)\" class=\"label\"\u003e\u003crect rx=\"0\" ry=\"0\" width=\"149.140625\" height=\"26.71875\"\u003e\u003c/rect\u003e\u003cforeignObject width=\"149.140625\" height=\"26.71875\"\u003e\u003cdiv xmlns=\"http://www.w3.org/1999/xhtml\" style=\"display: inline-block; white-space: nowrap;\"\u003e\u003cspan id=\"L-L-A-D\" class=\"edgeLabel L-LS-A' L-LE-D\"\u003eudpServerPort:23928\u003c/span\u003e\u003c/div\u003e\u003c/foreignObject\u003e\u003c/g\u003e\u003c/g\u003e\u003cg class=\"edgeLabel\" transform=\"translate(465.5234375,224.796875)\" style=\"opacity: 1;\"\u003e\u003cg transform=\"translate(-71.3984375,-13.359375)\" class=\"label\"\u003e\u003crect rx=\"0\" ry=\"0\" width=\"142.796875\" height=\"26.71875\"\u003e\u003c/rect\u003e\u003cforeignObject width=\"142.796875\" height=\"26.71875\"\u003e\u003cdiv xmlns=\"http://www.w3.org/1999/xhtml\" style=\"display: inline-block; white-space: nowrap;\"\u003e\u003cspan id=\"L-L-A-E\" class=\"edgeLabel L-LS-A' L-LE-E\"\u003eudpServerPor:22928\u003c/span\u003e\u003c/div\u003e\u003c/foreignObject\u003e\u003c/g\u003e\u003c/g\u003e\u003c/g\u003e\u003cg class=\"nodes\"\u003e\u003cg class=\"node default\" id=\"flowchart-B-40\" transform=\"translate(38.5078125,128.078125)\" style=\"opacity: 1;\"\u003e\u003ccircle x=\"-30.5078125\" y=\"-23.359375\" r=\"30.5078125\" class=\"label-container\"\u003e\u003c/circle\u003e\u003cg class=\"label\" transform=\"translate(0,0)\"\u003e\u003cg transform=\"translate(-20.5078125,-13.359375)\"\u003e\u003cforeignObject width=\"41.015625\" height=\"26.71875\"\u003e\u003cdiv xmlns=\"http://www.w3.org/1999/xhtml\" style=\"display: inline-block; white-space: nowrap;\"\u003eclient\u003c/div\u003e\u003c/foreignObject\u003e\u003c/g\u003e\u003c/g\u003e\u003c/g\u003e\u003cg class=\"node default\" id=\"flowchart-A-41\" transform=\"translate(303.17578125,128.078125)\" style=\"opacity: 1;\"\u003e\u003crect rx=\"0\" ry=\"0\" x=\"-37.77734375\" y=\"-23.359375\" width=\"75.5546875\" height=\"46.71875\" class=\"label-container\"\u003e\u003c/rect\u003e\u003cg class=\"label\" transform=\"translate(0,0)\"\u003e\u003cg transform=\"translate(-27.77734375,-13.359375)\"\u003e\u003cforeignObject width=\"55.5546875\" height=\"26.71875\"\u003e\u003cdiv xmlns=\"http://www.w3.org/1999/xhtml\" style=\"display: inline-block; white-space: nowrap;\"\u003eserverM\u003c/div\u003e\u003c/foreignObject\u003e\u003c/g\u003e\u003c/g\u003e\u003c/g\u003e\u003cg class=\"node default\" id=\"flowchart-C-43\" transform=\"translate(630.828125,31.359375)\" style=\"opacity: 1;\"\u003e\u003crect rx=\"0\" ry=\"0\" x=\"-36.88671875\" y=\"-23.359375\" width=\"73.7734375\" height=\"46.71875\" class=\"label-container\"\u003e\u003c/rect\u003e\u003cg class=\"label\" transform=\"translate(0,0)\"\u003e\u003cg transform=\"translate(-26.88671875,-13.359375)\"\u003e\u003cforeignObject width=\"53.7734375\" height=\"26.71875\"\u003e\u003cdiv xmlns=\"http://www.w3.org/1999/xhtml\" style=\"display: inline-block; white-space: nowrap;\"\u003eserverC\u003c/div\u003e\u003c/foreignObject\u003e\u003c/g\u003e\u003c/g\u003e\u003c/g\u003e\u003cg class=\"node default\" id=\"flowchart-D-45\" transform=\"translate(630.828125,128.078125)\" style=\"opacity: 1;\"\u003e\u003crect rx=\"0\" ry=\"0\" x=\"-40.734375\" y=\"-23.359375\" width=\"81.46875\" height=\"46.71875\" class=\"label-container\"\u003e\u003c/rect\u003e\u003cg class=\"label\" transform=\"translate(0,0)\"\u003e\u003cg transform=\"translate(-30.734375,-13.359375)\"\u003e\u003cforeignObject width=\"61.46875\" height=\"26.71875\"\u003e\u003cdiv xmlns=\"http://www.w3.org/1999/xhtml\" style=\"display: inline-block; white-space: nowrap;\"\u003eserverCS\u003c/div\u003e\u003c/foreignObject\u003e\u003c/g\u003e\u003c/g\u003e\u003c/g\u003e\u003cg class=\"node default\" id=\"flowchart-E-47\" transform=\"translate(630.828125,224.796875)\" style=\"opacity: 1;\"\u003e\u003crect rx=\"0\" ry=\"0\" x=\"-40.671875\" y=\"-23.359375\" width=\"81.34375\" height=\"46.71875\" class=\"label-container\"\u003e\u003c/rect\u003e\u003cg class=\"label\" transform=\"translate(0,0)\"\u003e\u003cg transform=\"translate(-30.671875,-13.359375)\"\u003e\u003cforeignObject width=\"61.34375\" height=\"26.71875\"\u003e\u003cdiv xmlns=\"http://www.w3.org/1999/xhtml\" style=\"display: inline-block; white-space: nowrap;\"\u003eserverEE\u003c/div\u003e\u003c/foreignObject\u003e\u003c/g\u003e\u003c/g\u003e\u003c/g\u003e\u003c/g\u003e\u003c/g\u003e\u003c/g\u003e\u003c/svg\u003e\u003c/pre\u003e\n\u003ch1 id=\"what-have-i-done-in-this-assignment\"\u003eWhat have I done in this assignment?\u003c/h1\u003e\n\u003cp\u003eIn this socket-programming project using \u003ccode\u003eCPP\u003c/code\u003e language, I implemented the simulation of a web registration process.\u003c/p\u003e\n\u003cp\u003eIn this process, a client will enter the course code and category of the information he/she wishes to retrieve.\u003c/p\u003e\n\u003cp\u003eThis \u003ccode\u003eclient\u003c/code\u003e will communicate with \u003ccode\u003eserverM\u003c/code\u003e process, which in turn will communicate with credential (\u003ccode\u003eserverC\u003c/code\u003e) and \u003cem\u003ebackend servers\u003c/em\u003e (\u003ccode\u003eserverEE\u003c/code\u003e, \u003ccode\u003eserverCS\u003c/code\u003e) .\u003c/p\u003e\n\u003cp\u003eI tested all code both on my local Mac (M2 chip) and studentVM (ubuntu 16).\u003c/p\u003e\n\u003ch1 id=\"comments\"\u003eComments\u003c/h1\u003e\n\u003cblockquote\u003e\n\u003cp\u003eIdiosyncrasies of the project\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp\u003ePlease keep following suggestions in mind while testing:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003e\n\u003cp\u003e\u003cstrong\u003ePlease prefer reading from readme.html\u003c/strong\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eIf while testing client is stopped or gets stuck, please \u003cstrong\u003erestart\u003c/strong\u003e all processes, it should start working fine.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003ePlease make sure course-ids are inputted in the syntax mentioned in \u003cem\u003e\u003cstrong\u003eHow to run the programs\u003c/strong\u003e\u003c/em\u003e section\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eIf while testing, authentication is failing, please restart client, serverM and serverC.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eIf \u003ccode\u003eserverM\u003c/code\u003e exits with following error\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003cpre\u003e\u003ccode\u003e\nlibc++abi: terminating with uncaught exception of type std::out_of_range: basic_string\n\nzsh: abort ./serverM\n\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003ePlease \u003cstrong\u003erestart\u003c/strong\u003e  \u003ccode\u003eclient\u003c/code\u003e , \u003ccode\u003eserverC\u003c/code\u003eand \u003ccode\u003eserverM\u003c/code\u003e processes.\u003c/p\u003e\n\u003col start=\"6\"\u003e\n\u003cli\u003eSometimes the I/O  buffers will not read properly, so the messages will not be printed properly on the console.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cpre\u003e\u003ccode\u003ejames sent a request to the main server.\nThe client received the response from the Main server using TCP over port 52446.\n.he CourseName of EE450 is Introduction to Computer Networks\n\u003c/code\u003e\u003c/pre\u003e\n\u003cpre\u003e\u003ccode\u003eThe ServerEE received a request from the Main Server about the CourseName of EE450.\nThe course information has been found: The CourseName of EE450 is Introduction to . mputer Networks\nThe ServerEE finished sending the response to the Main Server.\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eIt should get fixed by restarting all 5 processes.\u003c/p\u003e\n\u003ch2 id=\"how-to-run-the-programs\"\u003eHow to run the programs\u003c/h2\u003e\n\u003cp\u003ePlease start the 5 processes in following format:-\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003e\n\u003cp\u003eFirst open 5 different terminal window instances.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eUse one terminal and type \u003ccode\u003emake all\u003c/code\u003e to compile all the cpp files.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003cpre\u003e\u003ccode\u003e\nee450_hakim_kartik_9520882928 % make all\n\ng++ -std=c++11 -shared-libgcc serverM.cpp -o serverM\n\ng++ -std=c++11 -shared-libgcc serverC.cpp -o serverC\n\ng++ -std=c++11 -shared-libgcc serverEE.cpp -o serverEE\n\ng++ -std=c++11 -shared-libgcc serverCS.cpp -o serverCS\n\ng++ -std=c++11 -shared-libgcc client.cpp -o client\n\nee450_hakim_kartik_9520882928 %\n\n\u003c/code\u003e\u003c/pre\u003e\n\u003col start=\"3\"\u003e\n\u003cli\u003eStart the processes in following order\u003c/li\u003e\n\u003c/ol\u003e\n\u003cbr\u003e\n\u003cp\u003eTerminal 1: \u003ccode\u003e./serverEE\u003c/code\u003e\u003c/p\u003e\n\u003cp\u003eTerminal 2: \u003ccode\u003e./serverCS\u003c/code\u003e\u003c/p\u003e\n\u003cp\u003eTerminal 3: \u003ccode\u003e./serverC\u003c/code\u003e\u003c/p\u003e\n\u003cp\u003eTerminal 4: \u003ccode\u003e./serverM\u003c/code\u003e\u003c/p\u003e\n\u003cp\u003eTerminal 5: \u003ccode\u003e./client\u003c/code\u003e\u003c/p\u003e\n\u003col start=\"4\"\u003e\n\u003cli\u003eInput syntax in terminal 1, for client process:\u003c/li\u003e\n\u003c/ol\u003e\n\u003cul\u003e\n\u003cli\u003eWhile entering username and password:\u003c/li\u003e\n\u003c/ul\u003e\n\u003cpre\u003e\u003ccode\u003e\nee450_hakim_kartik_9520882928 % ./client\n\nThe client is up and running.\n\n  \n\nPlease enter the username: james\n\nPlease enter the password: Th!r3oe4s\n\njames sent an authentication request to the main server.\n\njames received the result of authentication using TCP over port 51750. Authentication failed: Password does not match.\n\nAttempts remaining: 2\n\n  \n\nPlease enter the username: amber\n\nPlease enter the password: cOntra4@positiv1e\n\namber sent an authentication request to the main server.\n\namber received the result of authentication using TCP over port 51759. Authentication failed: Password does not match.\n\nAttempts remaining: 1\n\n  \n\nPlease enter the username: james\n\nPlease enter the password: 2kAnsa7s)\n\njames sent an authentication request to the main server.\n\njames received the result of authentication using TCP over port 51767. Authentication is successful\n\n\u003c/code\u003e\u003c/pre\u003e\n\u003cul\u003e\n\u003cli\u003eWhile entering single course-ids\u003c/li\u003e\n\u003c/ul\u003e\n\u003cpre\u003e\u003ccode\u003e\nPlease enter the course code to query: EE450\n\nPlease enter the category(Credit / Professor / Days / CourseName): Days\n\njames sent a request to the main server.\n\nThe client received the response from the Main server using TCP over port 51767.\n\nThe Days of EE450 is Tue;Thu\n\n\u003c/code\u003e\u003c/pre\u003e\n\u003cul\u003e\n\u003cli\u003eWhile entering multiple course-ids\u003c/li\u003e\n\u003c/ul\u003e\n\u003cpre\u003e\u003ccode\u003e\nPlease enter the course code to query: EE450 CS100 EE520\n\njames sent a request to the main server.\n\nThe client received the response from the Main server using TCP over port 52001.\n\nCourseCode: Credits, Professor, Days, Course Name\n\nEE450: 4,Ali Zahid,Tue;Thu,Introduction to Computer Networks\n\nCS100: 4,Sathyanaraya Raghavachary,Tue;Thu,Explorations in Computing\n\nEE520: 4,Todd Brun,Tue;Thu,Introduction to Quantum Information Processing\n\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003e\u003cstrong\u003eIncorrect way of input\u003c/strong\u003e\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cp\u003eDO NOT ENTER UNEXPECTED SPACES\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eEND ALL LINES USING NEWLINE CHARACTERS\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cpre\u003e\u003ccode\u003e\nPlease enter the course code to query: EE450 CS100\n\nEE520\n\njames sent a request to the main server.\n\nThe client received the response from the Main server using TCP over port 52029.\n\nCourseCode: Credits, Professor, Days, Course Name\n\nEE450: 4,Ali Zahid,Tue;Thu,Introduction to Computer Networks\n\nCS100: 4,Sathyanaraya Raghavachary,Tue;Thu,Explorations in Computing\n\nEE520: 4,Todd Brun,Tue;Thu,Introduction to Quantum Information Processing\n\n\u003c/code\u003e\u003c/pre\u003e\n\u003cpre\u003e\u003ccode\u003e\nPlease enter the course code to query: EE450\n\n  \n  \n  \n  \n  \n  \n\nEE520\n\njames sent a request to the main server.\n\nThe client received the response from the Main server using TCP over port 52030.\n\nCourseCode: Credits, Professor, Days, Course Name\n\nEE450: 4,Ali Zahid,Tue;Thu,Introduction to Computer Networks\n\nEE520: 4,Todd Brun,Tue;Thu,Introduction to Quantum Information Processing\n\n  \n\n-----Start a new request-----\n\n  \n\nPlease enter the course code to query:\n\n\u003c/code\u003e\u003c/pre\u003e\n\u003ch2 id=\"implementations\"\u003eImplementations\u003c/h2\u003e\n\u003cblockquote\u003e\n\u003cp\u003eWhat your code files are and what each one of them does\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003ch4 id=\"client\"\u003e\u003ccode\u003eclient\u003c/code\u003e\u003c/h4\u003e\n\u003cp\u003eThe workflow of \u003ccode\u003eclient\u003c/code\u003e is as follows:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003e\n\u003cp\u003eclient process start a \u003cstrong\u003eTCP\u003c/strong\u003e socket and uses a dynamically assigned port number.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eEnter the username and password.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eThe given username and password (say u1,p1), are appended in a string template \u003ccode\u003eusername:\u0026lt;u1\u0026gt;,password:\u0026lt;p1\u0026gt;\u003c/code\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eThis template is sent via TCP to \u003ccode\u003eserverM\u003c/code\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eThe serverM checks with \u003ccode\u003eserverC\u003c/code\u003e and responds, via TCP, one of the following strings as response:\u003cbr\u003e\n*  \u003ccode\u003eUsername not found\u003c/code\u003e\u003cbr\u003e\n*  \u003ccode\u003eUsername found, Password didnt match\u003c/code\u003e\u003cbr\u003e\n* \u003ccode\u003eUsername verified\u003c/code\u003e\u003cbr\u003e\n* \u003ccode\u003eNot sure\u003c/code\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eIf the response is \u003ccode\u003eUsername verified\u003c/code\u003e, client will expect to read course and category and code will move to steps 7-10.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eIf the response is not \u003ccode\u003eUsername verified\u003c/code\u003e, steps 1-6 will be repeated.\u003c/p\u003e\n\u003col start=\"7\"\u003e\n\u003cli\u003e\n\u003cp\u003eUser will enter course code and category(expected values are \u003ccode\u003eCredit\u003c/code\u003e / \u003ccode\u003eProfessor\u003c/code\u003e / \u003ccode\u003eDays\u003c/code\u003e / \u003ccode\u003eCourseName\u003c/code\u003e ), say c1 and c2.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eWill create a string template \u003ccode\u003ecourse:\u0026lt;c1\u0026gt;,category:\u0026lt;c2\u0026gt;\u003c/code\u003e and send to serverM via TCP.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003eserverM\u003c/code\u003e will check with respective backend servers, via \u003cstrong\u003eUDP\u003c/strong\u003e, and responds either with the requested information (if the course-code is present in DB) or with string \u003ccode\u003eNO_DATA\u003c/code\u003e (if the course-code is not present in DB).\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eclient will process the response from serverM, via \u003cstrong\u003eTCP\u003c/strong\u003e, and print appropriate messages on the console.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id=\"section\"\u003e\u003c/h2\u003e\n\u003ch3 id=\"serverm\"\u003e\u003ccode\u003eserverM\u003c/code\u003e\u003c/h3\u003e\n\u003cp\u003eThe workflow of \u003ccode\u003eserverM\u003c/code\u003eis as follows:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003e\n\u003cp\u003eserverM expects to receive a string template of format \u003ccode\u003eusername:\u0026lt;u1\u0026gt;,password:\u0026lt;p1\u0026gt;\u003c/code\u003e from client via \u003cstrong\u003eTCP\u003c/strong\u003e over port \u003cstrong\u003e25928\u003c/strong\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003eserverM\u003c/code\u003e extracts the username, \u003ccode\u003eu1\u003c/code\u003e and password, \u003ccode\u003ep1\u003c/code\u003e from the template and encrypts them.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eThe encrypted username and password, say \u003ccode\u003ee1\u003c/code\u003e and \u003ccode\u003ee2\u003c/code\u003e, are sent to \u003ccode\u003eserverC\u003c/code\u003e via \u003cstrong\u003eUDP\u003c/strong\u003e over port \u003cstrong\u003e24928\u003c/strong\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003eserverC\u003c/code\u003e replies, via \u003cstrong\u003eUDP\u003c/strong\u003e, with one of the following strings:\u003cbr\u003e\n*  \u003ccode\u003eUsername not found\u003c/code\u003e\u003cbr\u003e\n*  \u003ccode\u003eUsername found, Password didnt match\u003c/code\u003e\u003cbr\u003e\n* \u003ccode\u003eUsername verified\u003c/code\u003e\u003cbr\u003e\n* \u003ccode\u003eNot sure\u003c/code\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003eserverM\u003c/code\u003e forwards these response from \u003ccode\u003eserverC\u003c/code\u003e to \u003ccode\u003eclient\u003c/code\u003e, via \u003cstrong\u003eTCP\u003c/strong\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eIf the \u003ccode\u003eserverC\u003c/code\u003e, response is \u003ccode\u003eUsername verified\u003c/code\u003e, a flag is set, to expect course-category string template, from \u003ccode\u003eclient\u003c/code\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eOnce the flag is set, \u003ccode\u003eserverM\u003c/code\u003e receives client-category template from client.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003eserverM\u003c/code\u003e will extract course and category, say \u003ccode\u003ec1\u003c/code\u003e and \u003ccode\u003ec2\u003c/code\u003e, and based on the first 2 characters of course \u003ccode\u003ec1\u003c/code\u003e will choose appropriate \u003cem\u003ebackend servers\u003c/em\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003eserverM\u003c/code\u003e will send the string template \u003ccode\u003ecourse:\u0026lt;c1\u0026gt;,category:\u0026lt;c2\u0026gt;\u003c/code\u003e to \u003cem\u003ebackend servers\u003c/em\u003e (\u003ccode\u003eserverCS\u003c/code\u003e or \u003ccode\u003eserverEE\u003c/code\u003e) via \u003cstrong\u003eUDP\u003c/strong\u003e over port, \u003cstrong\u003e24928\u003c/strong\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eOnce \u003ccode\u003eserverM\u003c/code\u003e receives the response, it forwards it to client, via \u003cstrong\u003eTCP\u003c/strong\u003e over port \u003cstrong\u003e25928\u003c/strong\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id=\"section-1\"\u003e\u003c/h2\u003e\n\u003ch4 id=\"serverc\"\u003e\u003ccode\u003eserverC\u003c/code\u003e\u003c/h4\u003e\n\u003cp\u003eThe workflow of \u003ccode\u003eserverC\u003c/code\u003e is as follows:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003eserverC\u003c/code\u003e expects a string containing \u003ccode\u003eu1,p1\u003c/code\u003e via \u003cstrong\u003eUDP\u003c/strong\u003e over port \u003cstrong\u003e21928\u003c/strong\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003eserverC\u003c/code\u003e reads the txt file \u003ccode\u003ecred.txt\u003c/code\u003e and stores in a global map variable.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eOnce we receive the string, we extract \u003ccode\u003eu1\u003c/code\u003e and \u003ccode\u003ep1\u003c/code\u003e and look for \u003ccode\u003eu1\u003c/code\u003e as a \u003cstrong\u003ekey\u003c/strong\u003e in the global map.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eIf \u003ccode\u003eu1\u003c/code\u003e is found in the map, we check \u003ccode\u003ep1\u003c/code\u003e is similar to password stored in map.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eBased on both the comparison, a string response is selected:\u003cbr\u003e\n*  \u003ccode\u003eUsername not found\u003c/code\u003e\u003cbr\u003e\n*  \u003ccode\u003eUsername found, Password didnt match\u003c/code\u003e\u003cbr\u003e\n* \u003ccode\u003eUsername verified\u003c/code\u003e\u003cbr\u003e\n* \u003ccode\u003eNot sure\u003c/code\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eThis string response is replied back to \u003ccode\u003eserverM\u003c/code\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id=\"section-2\"\u003e\u003c/h2\u003e\n\u003ch4 id=\"servercsee\"\u003e\u003ccode\u003eserverCS/EE\u003c/code\u003e\u003c/h4\u003e\n\u003cp\u003eThe workflow of backend servers (\u003ccode\u003eserverEE\u003c/code\u003e/\u003ccode\u003eserverCS\u003c/code\u003e) is as follows:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003eserverEE/CS\u003c/code\u003e expects a string containing \u003ccode\u003ecourse:\u0026lt;c1\u0026gt;,category:\u0026lt;c2\u0026gt;\u003c/code\u003e via \u003cstrong\u003eUDP\u003c/strong\u003e over port \u003cstrong\u003e23928(serverEE)\u003c/strong\u003e or port \u003cstrong\u003e22928(serverCS)\u003c/strong\u003e from \u003ccode\u003eserverM\u003c/code\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003eserverEE/CS\u003c/code\u003e reads the txt file \u003ccode\u003eee.txt\u003c/code\u003e (serverEE) or \u003ccode\u003ecs.txt\u003c/code\u003e (serverCS) and stores in 4 global map variables (\u003cem\u003ecredit / professor name/ course name / credits\u003c/em\u003e).\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eOnce we receive the string, we extract course id, \u003ccode\u003ec1\u003c/code\u003e, and course category, \u003ccode\u003ec2\u003c/code\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eBased on \u003ccode\u003ec2\u003c/code\u003e, category, we select the appropriate map variable, search for course id \u003ccode\u003ec1\u003c/code\u003e, and store the response as string.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eIf course code is not found, we set the response to \u003ccode\u003eNOT_FOUND\u003c/code\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eWe reply back the response to \u003ccode\u003eserverM\u003c/code\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eFor \u003cstrong\u003eextra credit section\u003c/strong\u003e, I set \u003cu\u003ecategory to \u003ccode\u003eeverything\u003c/code\u003e and read information from all 4 global variable maps and append them in the response variable \u003c/u\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id=\"message-formats\"\u003eMessage Formats\u003c/h2\u003e\n\n\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth align=\"center\"\u003ecode\u003c/th\u003e\n\u003cth align=\"right\"\u003eUserName / Password\u003c/th\u003e\n\u003cth align=\"right\"\u003eCourseCategory\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd align=\"center\"\u003eclient\u003c/td\u003e\n\u003ctd align=\"right\"\u003e\u003ccode\u003eusername:u1,password:p1\u003c/code\u003e\u003c/td\u003e\n\u003ctd align=\"right\"\u003e\u003ccode\u003ecourse:c1,category:c2\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"center\"\u003eserverM\u003c/td\u003e\n\u003ctd align=\"right\"\u003e\u003ccode\u003eusername:eU1,password:eP1\u003c/code\u003e\u003c/td\u003e\n\u003ctd align=\"right\"\u003e\u003ccode\u003ecourse:c1,category:c2\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"center\"\u003eserverC\u003c/td\u003e\n\u003ctd align=\"right\"\u003e\u003ccode\u003eusername:eU1,password:eP1\u003c/code\u003e\u003c/td\u003e\n\u003ctd align=\"right\"\u003eNA\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"center\"\u003eserverCS\u003c/td\u003e\n\u003ctd align=\"right\"\u003eNA\u003c/td\u003e\n\u003ctd align=\"right\"\u003e\u003ccode\u003ec1,c2\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd align=\"center\"\u003eserverEE\u003c/td\u003e\n\u003ctd align=\"right\"\u003eNA\u003c/td\u003e\n\u003ctd align=\"right\"\u003e\u003ccode\u003ec1,c2\u003c/code\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003cp\u003ewhere:\u003cbr\u003e\nu1 : username entered on client terminal\u003cbr\u003e\np1 : password enter on client terminal\u003cbr\u003e\neU1: encrypted username sent by serverM to serverC\u003cbr\u003e\neP1 : encrypted password sent by serverM to serverC\u003cbr\u003e\nc1 : course id entered on client terminal sent by client to serverM to backend servers\u003cbr\u003e\nc2 : course category entered on client terminal by client to serverM to backend servers\u003c/p\u003e\n\u003ch2 id=\"reused-code\"\u003eReused Code\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://beej.us/guide/bgnet/pdf/bgnet_usl_c_1.pdf\"\u003eBeej\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eFor example\u003c/p\u003e\n\u003cp\u003e\u003cbr\u003efrom section 6.5:-\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e\nint sockfd, rv, numbytes;\n\n  \n\nstruct addrinfo hints, *servinfo, *p;\n\n  \n\nstruct sockaddr_storage their_addr;\n\n  \n\n  \n\nsocklen_t addr_len;\n\n  \n\nchar s[INET6_ADDRSTRLEN];\n\n  \n\nmemset(\u0026amp;hints, 0, sizeof hints);\n\n  \n\nhints.ai_family = AF_INET6;\n\n  \n\nhints.ai_socktype = SOCK_DGRAM;\n\n  \n\n//hints.ai_flags = AI_PASSIVE; // use my IP\n\n  \n\nhints.ai_flags = INADDR_ANY; // using localhost as IP\n\n  \n\nif ((rv = getaddrinfo(NULL, MY_UDP_PORT, \u0026amp;hints, \u0026amp;servinfo)) != 0)\n\n  \n\n{\n\n  \n\nfprintf(stderr, \"getaddrinfo: %s\\n\", gai_strerror(rv));\n\n  \n\nexit(2);\n\n  \n\n}\n\n  \n\n  \n\n// loop through all the results and bind to the first we can\n\n  \n\nfor (p = servinfo; p != NULL; p = p-\u0026gt;ai_next)\n\n  \n\n{\n\n  \n\nif ((sockfd = socket(p-\u0026gt;ai_family, p-\u0026gt;ai_socktype, p-\u0026gt;ai_protocol)) == -1)\n\n  \n\n{\n\n  \n\nperror(\"serverEE : socket\");\n\n  \n\ncontinue;\n\n  \n\n}\n\n  \n\n  \n\nif (::bind(sockfd, p-\u0026gt;ai_addr, p-\u0026gt;ai_addrlen) == -1)\n\n  \n\n{\n\n  \n\nclose(sockfd);\n\n  \n\nperror(\"bind failed in serverEE, will try another socket\");\n\n  \n\ncontinue;\n\n  \n\n}\n\n  \n\n  \n\nbreak;\n\n  \n\n}\n\n  \n\n  \n\nif (p == NULL)\n\n  \n\n{\n\n  \n\nfprintf(stderr, \"bind failed in serverEE\\n\");\n\n  \n\nexit(2);\n\n  \n\n}\n\n  \n\n  \n\nfreeaddrinfo(servinfo);\n\n\u003c/code\u003e\u003c/pre\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://www.linuxhowtos.org/C_C++/socket.htm\"\u003eLinuxHowTo\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eFor example:-\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e\nread(newsockfd,buffer,255)\n\n\u003c/code\u003e\u003c/pre\u003e\n\u003cpre\u003e\u003ccode\u003e\nif (connect(sockfd,\u0026amp;serv_addr,sizeof(serv_addr)) \u0026lt; 0)\n\nerror(\"ERROR connecting\");\n\n\u003c/code\u003e\u003c/pre\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://www.geeksforgeeks.org/socket-programming-cc/\"\u003eGeeksForGeeks\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cpre\u003e\u003ccode\u003e\nint sockfd = socket(domain, type, protocol) ;\n\n  \n\nint bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen) ;\n\n  \n\nint new_socket= accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);\n\n\u003c/code\u003e\u003c/pre\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://www.tutorialspoint.com/parsing-a-comma-delimited-std-string-in-cplusplus\"\u003eTutorialsPoint\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cpre\u003e\u003ccode\u003e\nvector\u0026lt;string\u0026gt; result;\n\n  \n\nstringstream s_stream(my_str); //create string stream from the string\n\nwhile (s_stream.good())\n\n  \n\n{\n\nstring substr;\n\ngetline(s_stream, substr, ','); //get first string delimited by comma\n\nresult.push_back(substr);\n\n}\n\n  \n\n\u003c/code\u003e\u003c/pre\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://stackoverflow.com/questions/216823/how-to-trim-an-stdstring\"\u003eStackOverflow\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cpre\u003e\u003ccode\u003e\nvoid ltrim(string \u0026amp;s) {\n\n  \n\ns.erase(s.begin(), find_if(s.begin(), s.end(), [](unsigned char ch) {\n\n  \n\nreturn !std::isspace(ch);\n\n  \n\n}));\n\n  \n\n}\n\n  \n\n  \n\n// trim from end (in place)\n\n  \n\nvoid rtrim(string \u0026amp;s) {\n\n  \n\ns.erase(find_if(s.rbegin(), s.rend(), [](unsigned char ch) {\n\n  \n\nreturn !std::isspace(ch);\n\n  \n\n}).base(), s.end());\n\n  \n\n}\n\n  \n\n  \n\n// trim from both ends (in place)\n\n  \n\nvoid trim(string \u0026amp;s) {\n\n  \n\nltrim(s);\n\n  \n\nrtrim(s);\n\n  \n\n}\n\n\u003c/code\u003e\u003c/pre\u003e\n\u003ch2 id=\"extra-files\"\u003eExtra files\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003estringUtil.h\u003c/code\u003e : custom header file having string trimming code for given input string.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003ecodec.h\u003c/code\u003e : custom header having encryption / decryption code for credential verification.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003c/body\u003e\n\n\u003c/html\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhakimkartik%2Fcourse-registration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhakimkartik%2Fcourse-registration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhakimkartik%2Fcourse-registration/lists"}