X-Original-To: pgsql-hackers@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A7481475F00 for ; Fri, 25 Apr 2003 08:30:24 -0400 (EDT) Received: from snoopy.mohawksoft.com (h0030f1382639.ne.client2.attbi.com [24.60.194.163]) by postgresql.org (Postfix) with ESMTP id 0044C475E82 for ; Fri, 25 Apr 2003 08:30:24 -0400 (EDT) Received: from mohawksoft.com (snoopy.mohawksoft.com [127.0.0.1]) by snoopy.mohawksoft.com (8.12.8/8.12.8) with ESMTP id h3PCTTK5022221; Fri, 25 Apr 2003 08:29:29 -0400 Message-ID: <3EA92A29.3070708@mohawksoft.com> Date: Fri, 25 Apr 2003 08:29:29 -0400 From: mlw User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bruce Momjian , pgsql-hackers@postgresql.org Subject: Re: close() vs. closesocket() References: <200304241835.h3OIZ2s04294@candle.pha.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-25.9 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,REFERENCES,USER_AGENT_MOZILLA_UA autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/890 X-Sequence-Number: 38380 In porting to Windows, I would create a new source file called pgsocket, or something, and implement *all* the socket cruft there. Where ever you mess with a socket, i.e. send, recv, poll, accept, listen, get/setsockopt, select, etc. make it a function. Furthermore, try to bring some of the logical cruft that goes along with sockets and bring it into the module, i.e. don't call select(...) then call recv, call SocketSelectRead(...). Windows' sockets aren't very good. They will be good enough to be functional, but eventually, someone will want to rewrite with completion ports. Bruce Momjian wrote: >Looking at libpq, you can see Win32 requires closesocket() while Unix >uses just uses close(). > >I have to add this type of change to the backend for Win32, so I am >inclined to make all the socket close calls closesocket() and #define >that as close() on Unix? It would remove quite a few Win32 defs from >libpq too. > >Comments? > > >