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,PDS_OTHER_BAD_TLD autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!gegeweb.org!news.ecp.fr!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Re: Need help creating a multi client TCP server with Ada Date: Fri, 07 Feb 2014 09:48:27 +0100 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: <87vbwrmhpg.fsf@adaheads.sparre-andersen.dk> References: <1408dd3b-f555-4b75-94ef-cdb9c06ed0ca@googlegroups.com> <173b40e2-b288-4375-9842-e6058e565379@googlegroups.com> NNTP-Posting-Host: monowall.adaheads.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: loke.gir.dk 1391762908 27638 86.48.41.195 (7 Feb 2014 08:48:28 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 7 Feb 2014 08:48:28 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:t8ZtEdVZBIpF3nQv80IFXBQ5by4= Xref: news.eternal-september.org comp.lang.ada:18417 Date: 2014-02-07T09:48:27+01:00 List-Id: 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"