comp.lang.ada
 help / color / mirror / Atom feed
From: alex.aanis@gmail.com
Subject: Re: Need help creating a multi client TCP server with Ada
Date: Fri, 7 Feb 2014 09:16:03 -0800 (PST)
Date: 2014-02-07T09:16:03-08:00	[thread overview]
Message-ID: <cfc49abb-92cc-48b6-b8c6-9f81d734b4c0@googlegroups.com> (raw)
In-Reply-To: <87vbwrmhpg.fsf@adaheads.sparre-andersen.dk>

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?







  reply	other threads:[~2014-02-07 17:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06 21:42 Need help creating a multi client TCP server with Ada alex.aanis
2014-02-06 22:23 ` adambeneschan
2014-02-06 23:40   ` alex.aanis
2014-02-07  8:48     ` Jacob Sparre Andersen
2014-02-07 17:16       ` alex.aanis [this message]
2014-02-07 17:53         ` Dmitry A. Kazakov
2014-02-07 18:34 ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox