From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 20 08:11:22 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 4632310656C9 for ; Fri, 20 Mar 2009 08:11:22 +0000 (UTC) (envelope-from ota@j.email.ne.jp) Received: from mail1.asahi-net.or.jp (mail1.asahi-net.or.jp [202.224.39.197]) by mx1.freebsd.org (Postfix) with ESMTP id 173ED8FC21 for ; Fri, 20 Mar 2009 08:11:22 +0000 (UTC) (envelope-from ota@j.email.ne.jp) Received: from localhost (pool-141-151-75-22.phlapa.east.verizon.net [141.151.75.22]) by mail1.asahi-net.or.jp (Postfix) with ESMTP id 22AD3505B9 for ; Fri, 20 Mar 2009 16:53:26 +0900 (JST) Date: Fri, 20 Mar 2009 04:53:19 -0400 From: Yoshihiro Ota To: freebsd-hackers@freebsd.org Message-Id: <20090320045319.04484fc5.ota@j.email.ne.jp> X-Mailer: Sylpheed 2.6.0 (GTK+ 2.12.11; i386-portbld-freebsd7.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: 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 08:11:23 -0000 Hi forks. I have question on network programming. It will be nice if some could answer. 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. First of all, because TCP is already bi-directional communication, I don't think it is unnecessary to make 2 connection in the first place. After talking to my friend, he said it was very bad to do such things for three reasons. 1. With TCP connections, only sender side can detect some communication issues passively if happened. By using two connections, you lost that ability by your self. I agree on this one. 2. He also said that it would also waste network bandwidth. 3. He also said that it would causes some data flushing/synchronization issues. Indeed, this was what I saw with the program. However, I couldn't understand why it could happen. What I saw was from time to time, the sender side reported it send messages with some sequence numbers but the receiver didn't actually receive these messages for a long time, I think it was about a couple of seconds to several seconds between two hosts on the same switch. Could anyone explain if #2 is true and why #3 happens? Regards, Hiro