Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3596730iog; Tue, 21 Jun 2022 01:55:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s44p3D2K66uxOV2KxU2Mono+f73Gji7W3FvjnCE06cU9WgETAS2DdEXY6/St1g5+3ig82F X-Received: by 2002:aa7:c9d2:0:b0:42e:1776:63e0 with SMTP id i18-20020aa7c9d2000000b0042e177663e0mr33421995edt.185.1655801753087; Tue, 21 Jun 2022 01:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655801753; cv=none; d=google.com; s=arc-20160816; b=Eg2ck1+q36J1+dqnr43+8itX43p4L8wyNeBGH7H0VvhfFx/tCrS7MRoqAMNTReruk7 KPcvh0+dUiqmMZ9coRU+SSCUCJ0PyxEwtVSu0BXuaunX/jMhMpIYzq0CM2aNivmC+u1a 0tqDEi0674/PQVCy53b2bpG0pzaQ0x8hH08zHZc6fSgc40mo5IIre86+yGzCz2iJ6o6q SwkH9hAl7CM3XP4NrzkVTbpiwM4wFyinrL0zQjN4eocNPNUs9UggtZupFTjWRcZoAFtz RV85j1L2j76jcdR5XqodVPMSVOWDIPULXrxNqYyiC0B3ngDeAmfVwqPoHial1cvAIYAC rjBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :bimi-selector:from:cc:references:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature:dkim-filter; bh=YZ81fjTKo/UYSEbtnBxZUB9g2m46rZ2UpolJeNl5ia0=; b=WsdssUdCwq4oKxGb5wMz52bicEfvkzpSwBHWgzQinMpGSlc0q5V74sxUxki5Mmdbb2 zQcsxC5KHt/hQsuUieJHUFIZMh6R+wCzC8yL1fsZJWPe9O0Ts2UAGJ+Gr1UbwrqbbILl XLJ4B5CHHZ1t5zY3JC74/A9QN2ZnwVBNaKqkiSes42+MO9GuJFtN01XTOsGc6ZxqPl+A Iu0IRsW45MC/ZQGqCXpDo5x4hDIuNdgHMQB4D5FBylXQRn4yzCGeo9rdUO77aPNiwcR6 wOjgxly7gEw2nHueqnicTerLcLf2ywmmIdyBjOT1pXUz13T6xGelFoZbmR+rsUjvgaou 3lLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@petrovitsch.priv.at header.s=default header.b=Bh5SKEUP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=petrovitsch.priv.at Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fk3-20020a056402398300b004357dec2beasi6552671edb.73.2022.06.21.01.55.27; Tue, 21 Jun 2022 01:55:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@petrovitsch.priv.at header.s=default header.b=Bh5SKEUP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=petrovitsch.priv.at Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346335AbiFUHrP (ORCPT + 99 others); Tue, 21 Jun 2022 03:47:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344495AbiFUHrM (ORCPT ); Tue, 21 Jun 2022 03:47:12 -0400 X-Greylist: delayed 2655 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 21 Jun 2022 00:47:09 PDT Received: from esgaroth.petrovitsch.at (unknown [IPv6:2a01:4f8:120:527b:6876:2a4f:a044:62ad]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32B0723BCA for ; Tue, 21 Jun 2022 00:47:09 -0700 (PDT) Received: from [172.16.0.14] (84-115-219-246.cable.dynamic.surfer.at [84.115.219.246]) (authenticated bits=0) by esgaroth.petrovitsch.at (8.17.1/8.17.1) with ESMTPSA id 25L72lm63449013 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT); Tue, 21 Jun 2022 09:02:48 +0200 DKIM-Filter: OpenDKIM Filter v2.11.0 esgaroth.petrovitsch.at 25L72lm63449013 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=petrovitsch.priv.at; s=default; t=1655794968; bh=YZ81fjTKo/UYSEbtnBxZUB9g2m46rZ2UpolJeNl5ia0=; h=Date:Subject:To:References:Cc:From:In-Reply-To:From; b=Bh5SKEUPFNJgHy+Ujp6DQTYjh+RjlpP0kpxaQgdAw6CGJ0NHAG4CKedqzUwSNRqPG 18llQNELXUgd+LGLOIGyQFdzpA2LDoIM7Nf5wmDqIvWy11FNUpybUwfPjk9KNmiCVr HtTm02d0bZoMBef+D7di1t6oePszRz6Q0rBw48K8= X-Info-sendmail: I was here Message-ID: Date: Tue, 21 Jun 2022 09:02:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: Networking Question Content-Language: en-US To: "Ryan P. Nicholl" References: <6_nVwntZEyEq2Gn0PYDz5w_yuD20E9Je_Bk2rJHsOersGq3v2x3_6hXnyjNm-X83-OTl1KKo4eLoHzyBVM_nzCcDrpPtz4dz3_71A3QezfI=@protonmail.com> Cc: linux-kernel From: Bernd Petrovitsch BIMI-Selector: v=BIMI1; s=default In-Reply-To: <6_nVwntZEyEq2Gn0PYDz5w_yuD20E9Je_Bk2rJHsOersGq3v2x3_6hXnyjNm-X83-OTl1KKo4eLoHzyBVM_nzCcDrpPtz4dz3_71A3QezfI=@protonmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-DCC--Metrics: esgaroth.petrovitsch.priv.at 1102; Body=2 Fuz1=2 Fuz2=2 X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all! On 21/06/2022 02:29, Ryan P. Nicholl wrote: > I've been unable to find any Linux API for asynchronously waiting for the TCP send buffer to drain. > > The problem I have, in a nutshell, is noted in this part of the documentation: > > If fildes refers to a socket, close() shall cause the socket to > be destroyed. If the socket is in connection-mode, and the That's not really a Linux kernel question as such (because that should work that way on all TCP connections anywhere) but the shutdown() syscall is probably what you need: - your side shuts down the sending part of the socket. - the other side reads data and gets eventually EOF - the other side call shutdown() for it's sending side when it's done. - your side gets EOF. And then your side knows that no data is in flight. - finally, you clean up with close(). You can shutdown() the receiving side too but doesn't change anything. [ deleted SO_LINGER stuff - that's for something completelly different ... ] Kind regards, Bernd -- Bernd Petrovitsch Email : bernd@petrovitsch.priv.at There is NO CLOUD, just other people's computers. - FSFE LUGA : http://www.luga.at