From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 20 09:25:42 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88AA41065686 for ; Fri, 20 Mar 2009 09:25:42 +0000 (UTC) (envelope-from mdc@prgmr.com) Received: from mail.prgmr.com (mail.prgmr.com [64.62.173.114]) by mx1.freebsd.org (Postfix) with ESMTP id 764F58FC26 for ; Fri, 20 Mar 2009 09:25:42 +0000 (UTC) (envelope-from mdc@prgmr.com) Received: from frylock.local (c-71-198-249-174.hsd1.ca.comcast.net [71.198.249.174]) by mail.prgmr.com (Postfix) with ESMTP id B2F4F68B5B; Fri, 20 Mar 2009 01:57:31 -0700 (PDT) Message-ID: <49C35A58.2030607@prgmr.com> Date: Fri, 20 Mar 2009 01:56:56 -0700 From: Michael David Crawford Organization: Prgmr.com User-Agent: Thunderbird 2.0.0.19 (Macintosh/20081209) MIME-Version: 1.0 To: Yoshihiro Ota References: <20090320045319.04484fc5.ota@j.email.ne.jp> In-Reply-To: <20090320045319.04484fc5.ota@j.email.ne.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: 2 uni-directional TCP connection good? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Mar 2009 09:25:43 -0000 Yoshihiro Ota wrote: > I saw a program that opens 2 TCP connections. > One connection is only used for server to client messaging only > and the other connection is used only for client to server messaging. > 2. He also said that it would also waste network bandwidth. You have a two-way communication no matter what you do. But if you don't actually use inbound direction, all it gets used for is the receipt of ACK packets. That is, the inbound connection is used to make the data transfer reliable. If you don't have any payload data on the inbound connection, then the outbound connection won't have any ACK packets. If you're sending payload data, the ACK info can "hitchhike" along with the payload packets, thus saving bandwidth. But if you're not sending any payload data at all, there will be packets transmitted which contain the ACKs and nothing else. The extra network overhead will be modest if you're sending a lot of data all at once, say transferring a large file. But if very little data is sent per packet, say individual characters in a telnet connection, the overhead would be very high. If you have a single connection with payload data in both directions, then the ACKs will almost always ride along with some payload data. The only time a packet will contain nothing but an ACK will be when some data was transmitted, but none is to be received at the time. Mike -- Michael David Crawford mdc@prgmr.com prgmr.com - We Don't Assume You Are Stupid. Xen-Powered Virtual Private Servers: http://prgmr.com/xen