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.7 required=5.0 tests=AXB_XMAILER_MIMEOLE_OL_024C2, BAYES_00,MAILING_LIST_MULTI autolearn=no 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!newsfeed00.sul.t-online.de!t-online.de!tiscali!newsfeed1.ip.tiscali.net!proxad.net!freenix!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: "Andrew Carroll" Newsgroups: comp.lang.ada Subject: copy constructor for sockets Date: Mon, 24 May 2004 05:28:42 -0600 Organization: Cuivre, Argent, Or Message-ID: NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: melchior.cuivre.fr.eu.org 1085397054 65141 212.85.156.195 (24 May 2004 11:10:54 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Mon, 24 May 2004 11:10:54 +0000 (UTC) To: Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at rfc1149.net X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: controlnews3.google.com comp.lang.ada:798 Date: 2004-05-24T05:28:42-06:00 Wow, GREAT information!! Thanks all!! Steve, Matthew, Marius: Accept() does block, as you expected. At least with AdaSockets. I have three tasks. One is the "accepting" task and the other two tasks just do various work depending on the "method" of an HTTP header (obtained from the first Get_Line()). So, accept() initializes the socket, does one Get_Line() and then if the method is GET, then I want to pass the socket to task 'A'. If the method is POST then I want to pass the socket to task 'B'. In both cases, I want the task to provide the HTTP user with a response and close the socket. All the "accepting" task does is initialize sockets and create new tasks. Well, it will do other things but right now I am just experimenting. Your select() or poll() idea is beautiful! Because then, when an accept would occur, I can have the tasks ('A' or 'B') handle the whole "session". Question now is, how do I know which task to assign it to for handling? I cannot get into the HTTP header before I "accept". Hmmmm....Anyway... I once downloaded AWS but never really read about it because I was looking into the source code for other things about an idea I had, of which I gave up on. I went back to read about AWS recently and it provides the Callbacks and Method ?API? which would accomplish what I am trying to achieve. I haven't investigated "how" they did it and in fact I would rather drudge through this for learning purposes, at least for a while. So, in the end I think I will ask permission to use AWS and skip the "accepting" task in my design. Then place the task 'A' and task 'B' implementations in the Callback based on Method from AWS. (forgive me, I do not have the AWS documentation open to give accurate API names) Never the less I am learning some great things. You mentioned that a socket is a file descriptor (Unix) and I'm not quite sure I fully understand the implications of that. I "heard" that sockets were designed in such a way that it would be "transparent", like working with files. Does that mean I can do a seek() on a socket? When people throw out the term "file descriptor" and start talking about "small positive integers" I draw a blank as to how those are used for "communication" over a network device in general. After all, there are MANY small positive integers on my computer. I'm assuming the file descriptor (fd) means something to the OS? So somewhere in the kernel or "shell" interrupt handler there is an else if (//it is a small positive integer) { //must be a socket, fire-up the RS-232 driver}? I thought a socket was an abstraction from an address? For example. the address to a UART or RS-232 PIC. A driver of which is written (probably a module) to control that device. So how does a fd relate to that driver? Or are you saying that somewhere in my /dev directory there is a directory entry for my UART? I can just arbitrarily (at risk of destruction) send data to the UART through an entry in the /dev directory? I guess I'm just trying to fill in the holes of what I have learned thus far. Or maybe more appropriately what I have failed to learn. Thanks again!! Andrew Carroll Carroll-Tech 720-273-6814 andrew@carroll-tech.net