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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d0728b52f51f685e X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news1.google.com!news.glorb.com!wn14feed!worldnet.att.net!attbi_s03.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: copy constructor for sockets References: X-Newsreader: Tom's custom newsreader Message-ID: <_SPrc.95520$536.16845336@attbi_s03> NNTP-Posting-Host: 24.6.132.82 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s03 1085262394 24.6.132.82 (Sat, 22 May 2004 21:46:34 GMT) NNTP-Posting-Date: Sat, 22 May 2004 21:46:34 GMT Organization: Comcast Online Date: Sat, 22 May 2004 21:46:35 GMT Xref: controlnews3.google.com comp.lang.ada:782 Date: 2004-05-22T21:46:35+00:00 List-Id: >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.