comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: copy constructor for sockets
Date: Sat, 22 May 2004 21:46:35 GMT
Date: 2004-05-22T21:46:35+00:00	[thread overview]
Message-ID: <_SPrc.95520$536.16845336@attbi_s03> (raw)
In-Reply-To: mailman.9.1085259629.401.comp.lang.ada@ada-france.org

>So, the server must accept the socket and do an initial read to get the
>header information (GET or POST) to know which type of task to create.
>Then I want to initialize the socket that is in the task type to be the
>same as the socket in the server that was just accepted.  It would
>probably need to be a "deep copy" of the socket because the server will
>need to release the socket and the task will need to keep the socket.
>By release I mean close() and by keep I mean use for communication.

Remember that a task is a thread of control, not a sequence of
instructions.  From that viewpoint, your server needs to fire up a
task/thread, and that thread needs to find out whether it should execute
the Get or the Put sequence of instructions.  You can pass the server
socket to the task during the rendezvous, and let the task create a socket
and do the socket-accept.  That lets the server get back to waiting for
calls as quickly as possible, while the task does the Get_Line (which
could potentially take a while) and calls an appropriate Handle_Get or
Handle_Post procedure.  You can see an example of this in Smplsrvr (part
of the free Claw download at www.rrsoftware.com).  You might also want to
see how AWS does it.

> Doesn't the ":=" operator to a "deep copy"?
If the object is Limited, ":=" is illegal.  (That's the case for Claw
Sockets.) If it's Controlled, then ":=" does a bit pattern copy followed
by a call on Adjust, which may do nothing, may modify pointers or
whatever, or may do a deep copy - whatever it wants.  If the object is not
Controlled, and isn't Limited, then ":=" just does a bitwise copy.



  reply	other threads:[~2004-05-22 21:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-22 21:18 copy constructor for sockets Andrew Carroll
2004-05-22 21:46 ` tmoran [this message]
2004-05-23 11:21   ` Simon Wright
2004-05-24 18:26     ` tmoran
2004-05-25  5:10       ` Simon Wright
2004-05-25  6:37         ` tmoran
2004-05-23  9:43 ` Mark Lorenzen
2004-05-23 11:27 ` Simon Wright
  -- strict thread matches above, loose matches on Subject: below --
2004-05-24 11:28 Andrew Carroll
2004-05-25  5:29 ` Simon Wright
2004-05-22 10:19 Andrew Carroll
2004-05-22 11:55 ` Simon Wright
2004-05-22 18:39   ` tmoran
2004-05-23 21:04   ` Matthew Heaney
2004-05-24  7:13     ` Marius Amado Alves
2004-05-24  3:23       ` Matthew Heaney
2004-05-24  4:53         ` Simon Wright
2004-05-24  5:20           ` tmoran
2004-05-25  4:53             ` Simon Wright
2004-05-24 12:36           ` Matthew Heaney
2004-05-25 21:50           ` Robert I. Eachus
replies disabled

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