From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 2CB8213800E for ; Mon, 3 Feb 2014 22:04:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9F409E0B58; Mon, 3 Feb 2014 22:04:18 +0000 (UTC) Received: from icp-osb-irony-out5.external.iinet.net.au (icp-osb-irony-out5.external.iinet.net.au [203.59.1.221]) by pigeon.gentoo.org (Postfix) with ESMTP id 1FD9EE0AFB for ; Mon, 3 Feb 2014 22:04:16 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhwFAA4S8FLc/Zr3/2dsb2JhbABZgwyEELgIgwiBDxZ0giUBAQUjVRELDQsCAgUWCwICCQMCAQIBRRMIAQGIAKw/oTUXgSmNZxaCWYFJBIlHinuDaIZIKIsxgzov X-IronPort-AV: E=Sophos;i="4.95,774,1384272000"; d="scan'208";a="189473141" Received: from unknown (HELO moriah.localdomain) ([220.253.154.247]) by icp-osb-irony-out5.iinet.net.au with ESMTP; 04 Feb 2014 06:04:14 +0800 Received: from localhost (localhost [127.0.0.1]) by moriah.localdomain (Postfix) with ESMTP id 717E5141BF for ; Tue, 4 Feb 2014 06:04:14 +0800 (WST) X-Virus-Scanned: amavisd-new at lan.localdomain Received: from moriah.localdomain ([127.0.0.1]) by localhost (moriah.lan.localdomain [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X6t-Vb7jQXQZ for ; Tue, 4 Feb 2014 06:04:00 +0800 (WST) Received: from [192.168.44.3] (moriah [192.168.44.3]) by moriah.localdomain (Postfix) with ESMTP id 35D2314296 for ; Tue, 4 Feb 2014 06:04:00 +0800 (WST) Message-ID: <52F01250.8030600@iinet.net.au> Date: Tue, 04 Feb 2014 06:04:00 +0800 From: William Kenworthy User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Tcp Listener References: <52EFDCB4.5040106@gmail.com> <52F00D82.1060602@gmail.com> <52F00F70.7090407@gmail.com> In-Reply-To: <52F00F70.7090407@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Archives-Salt: d4ff0981-213d-42a9-96f3-1aeb5b943fd8 X-Archives-Hash: 9c18772fc95422e3a22fc04b91181fb9 On 04/02/14 05:51, xarman wrote: > > On 02/03/2014 11:43 PM, Alan McKinnon wrote: >> On 03/02/2014 20:15, xarman wrote: >>> I'm interested in making a TCP Listener in C / C++ on Linux to accept >>> many connections simultaneously. I did a relative search on the Web and >>> although I am aware of the C language as to a certain extent, I >>> struggle to find a model program. Essentially, it is the listener of a >>> server that receives a signal and stores it in a database and do some >>> other functions. I know how to do the functions but I'm looking for a >>> way to fix the basic skeleton of listener that will be always active. >>> I'm not sure if I need multi threading or multi socketing for multi >>> connections. >>> If you have any knowledge on the subject or have a simple example or even >>> some reference in order to work on that, I'd appreciate it. >>> >>> >> >> >> Is this a school homework question? >> >> >> > No. Why are you asking? > He is asking because its one of the common C/C++ computer science assignments! In practice, perl, python are usually simpler and easier to use. and the google-fu needed is to search for a TCP echo server to use as a staring point. BillK