From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00,FREEMAIL_FROM, PDS_OTHER_BAD_TLD autolearn=no autolearn_force=no version=3.4.4 X-Received: by 10.236.209.134 with SMTP id s6mr5118273yho.40.1391793363817; Fri, 07 Feb 2014 09:16:03 -0800 (PST) X-Received: by 10.140.94.234 with SMTP id g97mr333890qge.9.1391793363778; Fri, 07 Feb 2014 09:16:03 -0800 (PST) Path: border1.nntp.ams3.giganews.com!backlog3.nntp.ams3.giganews.com!backlog3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!209.85.216.87.MISMATCH!k15no13462237qaq.0!news-out.google.com!y18ni5935qap.1!nntp.google.com!k15no13462234qaq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 7 Feb 2014 09:16:03 -0800 (PST) In-Reply-To: <87vbwrmhpg.fsf@adaheads.sparre-andersen.dk> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.226.118.98; posting-account=Q4keDQoAAADVvR66mtecxKV-0pCNQlyk NNTP-Posting-Host: 85.226.118.98 References: <1408dd3b-f555-4b75-94ef-cdb9c06ed0ca@googlegroups.com> <173b40e2-b288-4375-9842-e6058e565379@googlegroups.com> <87vbwrmhpg.fsf@adaheads.sparre-andersen.dk> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Need help creating a multi client TCP server with Ada From: alex.aanis@gmail.com Injection-Date: Fri, 07 Feb 2014 17:16:03 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Original-Bytes: 3284 Xref: number.nntp.dca.giganews.com comp.lang.ada:184710 Date: 2014-02-07T09:16:03-08:00 List-Id: On Friday, February 7, 2014 9:48:27 AM UTC+1, Jacob Sparre Andersen wrote: > alex.aanis@gmail.com writes: > > > > > Yes, I now can can store the channels. However I still can't connect > > > more than one client. Is there something wrong with my listener task: > > > > > > task body listenerTask is > > > status : Sockets.Selector_Status; > > > Client : Sockets.Sock_Addr_Type; > > > Connection : Sockets.Socket_Type; > > > channel : Sockets.Stream_Access; > > > > > > begin > > > loop > > > Sockets.Accept_Socket ( > > > Server => Receiver, > > > Socket => Connection, > > > Address => Client, > > > timeout => 30.0, > > > Status => status > > > ); > > > > > > channel := Sockets.Stream (Connection); > > > channels.Append (channel); > > > > > > end loop; > > > end; > > > > It looks like it might work. Have you set up your receiver correctly? > > Where are the connections processed? It appears that "Channels" is a > > global variable. Have you made sure to make it protected? > > > > You may want to add an exception handler to your listener task for > > reporting any exceptions in the task. > > > > It would be nice if you could adhere to the style described in the Ada > > Quality and Style Guide (indentation, labels after "end", identifiers). > > > > Greetings, > > > > Jacob > > -- > > "Computer Science is to Science, as Plumbing is to Hydrodynamics" Thank you Jacob for replying. And thanks for the Ada style guidelines. Im at chapter 3 now. Could you please see my code here on Github: http://goo.gl/GaO2a3. The folder is called "TCP Communication". I've read about protected. But didn't quite understand it. How may I use protected types within a task?