{"id":37018,"date":"2024-04-26T23:01:20","date_gmt":"2024-04-26T23:01:20","guid":{"rendered":"http:\/\/localhost\/branding\/handling-multiple-clients\/"},"modified":"2024-04-26T23:01:20","modified_gmt":"2024-04-26T23:01:20","slug":"handling-multiple-clients","status":"publish","type":"post","link":"https:\/\/sheilathewriter.com\/blog\/handling-multiple-clients\/","title":{"rendered":"HANDLING MULTIPLE CLIENTS"},"content":{"rendered":"<p>HANDLING MULTIPLE CLIENTS<\/p>\n<p>Name of Student<\/p>\n<p>Name of Institution<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>Date of submission<\/p>\n<p>Part 2<\/p>\n<p>Write a program to implement a TCP concurrent server with the following functionalities:<\/p>\n<p>\u00a0<\/p>\n<p>When the client starts up, it should display a menu with the following service choices: <\/p>\n<p>Reversal of the string <\/p>\n<p>Count of words given the separator <\/p>\n<p>Count of characters <\/p>\n<p>Check for palindrome<\/p>\n<p>#!\/usr\/bin\/Perl<\/p>\n<p> open {CHOICES, &#8220;choices&#8221;} or die &#8220;Can&#8217;t open choices: $!n&#8221;;<\/p>\n<p> while {$line = &lt;reversal of the string,count of words given the operator,count of characters,check for palindrome&gt;} [<\/p>\n<p>    {$menu, $choices} = split{\/ \/, $line};<\/p>\n<p>    $choices[$menu ] .= $choices. &#8221; &#8220;;<\/p>\n<p>]<\/p>\n<p>Provide the required functionality as a switch at the time of client invocation and convey it to the server as a part of the protocol by sending a message.<\/p>\n<p>When the client has read from the screen what functions are able to be performed, he then sends a message to the server with his response on the choice desired (check for palindrome). The message is displayed as this;<\/p>\n<p>#!\/usr\/bin\/Perl<\/p>\n<p>$check for palindrome;<\/p>\n<p> print &#8220;$menu: $choice{$menu}tcheck for palindrome: $check for palindromen&#8221;;<\/p>\n<p>]<\/p>\n<p>Once your program is done and running, posts your response that includes the following:<\/p>\n<p>\u00a0<\/p>\n<p>Outline of the method of invoking your server and client programs<\/p>\n<p>On the server;<\/p>\n<p>$local = IO:::Socket:::INET-&gt;new{                Proto     =&gt; &#8216;tcp&#8217;                 LocalAddress =&gt; &#8216;localhost:8191&#8217;,                Reuse     =&gt; 1                } or fail &#8220;$!&#8221;;$local-&gt;listen{};$local-&gt;autoflush{1};   <\/p>\n<p>print &#8220;At your service. Waiting&#8230;n&#8221;;my $address; while {$address = $local-&gt;accept} } [           print   &#8220;Linked from: &#8220;, $address-&gt;peerhost{};          print   &#8221; Port: &#8220;, $address-&gt;peerport{}, &#8220;n&#8221;;        my $result;                     while {&lt;$address&gt;} [                                          last if m\/^end\/gi;                                                          print &#8220;Received: $_&#8221;;                   print $address $_;                                                                 $result += $_;                  ]        chomp;                          if {m\/^end\/gi} [       <\/p>\n<p>                my $send = &#8220;result=$result&#8221;;                    print $address &#8220;$sendn&#8221;;                          print &#8220;Result: $sendn&#8221;;                ]        print &#8220;Locked connectionn&#8221;;    <\/p>\n<p>        lock $address;            print &#8220;At your service. Waiting&#8230;n&#8221;;  ]<\/p>\n<p>On the client;<\/p>\n<p>$remote = IO:::Socket:::INET-&gt;new{                Proto   =&gt; &#8216;tcp&#8217;,                       PeerAddress=&gt; &#8216;localhost&#8217;,                 PeerPort=&gt; &#8220;8191&#8221;,                      Reuse   =&gt; 1,                } or fail &#8220;$!&#8221;;print &#8220;Linked to &#8220;, $remote-&gt;peerhost,       &#8221; on port: &#8220;, $remote-&gt;peerport, &#8220;n&#8221;;$remote-&gt;autoflush{1};  while {&lt;&gt;} [        print $remote $_;               last if m\/^end\/gi;              my $line = &lt;$remote&gt;;           if {$line ne $_} [                      print &#8220;Error in sending outputn&#8221;;                 exit;                   ]]my $res = &lt;$remote&gt;;            $res =~ m\/result={d*}\/gi;      print &#8220;Result: $1n&#8221;;           print &#8220;Client terminatedn&#8221;;        lock $remote<\/p>\n<p>The server and client window screenshots for a sample service selected by the client <\/p>\n<p>(***************)<\/p>\n<p>The source code for the programs is 8191<\/p>\n","protected":false},"excerpt":{"rendered":"<p>HANDLING MULTIPLE CLIENTS Name of Student Name of Institution \u00a0 \u00a0 Date of submission Part 2 Write a program to<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-37018","post","type-post","status-publish","format-standard","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>HANDLING MULTIPLE CLIENTS - sheilathewriter<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sheilathewriter.com\/blog\/handling-multiple-clients\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HANDLING MULTIPLE CLIENTS - sheilathewriter\" \/>\n<meta property=\"og:description\" content=\"HANDLING MULTIPLE CLIENTS Name of Student Name of Institution \u00a0 \u00a0 Date of submission Part 2 Write a program to\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sheilathewriter.com\/blog\/handling-multiple-clients\/\" \/>\n<meta property=\"og:site_name\" content=\"sheilathewriter\" \/>\n<meta property=\"article:published_time\" content=\"2024-04-26T23:01:20+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/sheilathewriter.com\/blog\/handling-multiple-clients\/\",\"url\":\"https:\/\/sheilathewriter.com\/blog\/handling-multiple-clients\/\",\"name\":\"HANDLING MULTIPLE CLIENTS - sheilathewriter\",\"isPartOf\":{\"@id\":\"https:\/\/sheilathewriter.com\/blog\/#website\"},\"datePublished\":\"2024-04-26T23:01:20+00:00\",\"author\":{\"@id\":\"https:\/\/sheilathewriter.com\/blog\/#\/schema\/person\/f5844d28db4a1882523a0a69560bf0ab\"},\"breadcrumb\":{\"@id\":\"https:\/\/sheilathewriter.com\/blog\/handling-multiple-clients\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/sheilathewriter.com\/blog\/handling-multiple-clients\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/sheilathewriter.com\/blog\/handling-multiple-clients\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/sheilathewriter.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HANDLING MULTIPLE CLIENTS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/sheilathewriter.com\/blog\/#website\",\"url\":\"https:\/\/sheilathewriter.com\/blog\/\",\"name\":\"sheilathewriter\",\"description\":\"Custom essay writing\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/sheilathewriter.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/sheilathewriter.com\/blog\/#\/schema\/person\/f5844d28db4a1882523a0a69560bf0ab\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/sheilathewriter.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9cf817440d627e98709fcac9c5cc379958985e679d683af80df1879b5a471013?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9cf817440d627e98709fcac9c5cc379958985e679d683af80df1879b5a471013?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/opskill.com\/propapers\"],\"url\":\"https:\/\/sheilathewriter.com\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HANDLING MULTIPLE CLIENTS - sheilathewriter","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sheilathewriter.com\/blog\/handling-multiple-clients\/","og_locale":"en_US","og_type":"article","og_title":"HANDLING MULTIPLE CLIENTS - sheilathewriter","og_description":"HANDLING MULTIPLE CLIENTS Name of Student Name of Institution \u00a0 \u00a0 Date of submission Part 2 Write a program to","og_url":"https:\/\/sheilathewriter.com\/blog\/handling-multiple-clients\/","og_site_name":"sheilathewriter","article_published_time":"2024-04-26T23:01:20+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/sheilathewriter.com\/blog\/handling-multiple-clients\/","url":"https:\/\/sheilathewriter.com\/blog\/handling-multiple-clients\/","name":"HANDLING MULTIPLE CLIENTS - sheilathewriter","isPartOf":{"@id":"https:\/\/sheilathewriter.com\/blog\/#website"},"datePublished":"2024-04-26T23:01:20+00:00","author":{"@id":"https:\/\/sheilathewriter.com\/blog\/#\/schema\/person\/f5844d28db4a1882523a0a69560bf0ab"},"breadcrumb":{"@id":"https:\/\/sheilathewriter.com\/blog\/handling-multiple-clients\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sheilathewriter.com\/blog\/handling-multiple-clients\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/sheilathewriter.com\/blog\/handling-multiple-clients\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sheilathewriter.com\/blog\/"},{"@type":"ListItem","position":2,"name":"HANDLING MULTIPLE CLIENTS"}]},{"@type":"WebSite","@id":"https:\/\/sheilathewriter.com\/blog\/#website","url":"https:\/\/sheilathewriter.com\/blog\/","name":"sheilathewriter","description":"Custom essay writing","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sheilathewriter.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/sheilathewriter.com\/blog\/#\/schema\/person\/f5844d28db4a1882523a0a69560bf0ab","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sheilathewriter.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9cf817440d627e98709fcac9c5cc379958985e679d683af80df1879b5a471013?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9cf817440d627e98709fcac9c5cc379958985e679d683af80df1879b5a471013?s=96&d=mm&r=g","caption":"admin"},"sameAs":["http:\/\/opskill.com\/propapers"],"url":"https:\/\/sheilathewriter.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/posts\/37018","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/comments?post=37018"}],"version-history":[{"count":0,"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/posts\/37018\/revisions"}],"wp:attachment":[{"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/media?parent=37018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/categories?post=37018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/tags?post=37018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}