From owner-freebsd-hackers@FreeBSD.ORG Tue Sep 6 15:54:57 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6F99D16A41F for ; Tue, 6 Sep 2005 15:54:57 +0000 (GMT) (envelope-from uvarovsl@mail.pnpi.spb.ru) Received: from mail.lsi.ru (mail.lsi.ru [212.58.192.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id D49EE43D45 for ; Tue, 6 Sep 2005 15:54:56 +0000 (GMT) (envelope-from uvarovsl@mail.pnpi.spb.ru) Received: by mail.lsi.ru (Postfix, from userid 426) id E6CFE386D7C; Tue, 6 Sep 2005 19:54:53 +0400 (MSD) Received: from [10.0.0.10] (unknown [212.58.210.222]) by mail.lsi.ru (Postfix) with ESMTP id 231F9386CA8; Tue, 6 Sep 2005 19:54:52 +0400 (MSD) Message-ID: <431DBBD0.5070302@mail.pnpi.spb.ru> Date: Tue, 06 Sep 2005 19:54:56 +0400 From: Sergey Uvarov User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050719 Fedora/1.7.10-1.5.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: erkan kolemen References: <20050906153451.86233.qmail@web33406.mail.mud.yahoo.com> In-Reply-To: <20050906153451.86233.qmail@web33406.mail.mud.yahoo.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: accept: Invalid argument 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: Tue, 06 Sep 2005 15:54:57 -0000 Did you issue listen(2) call before accepting connections? Sergey. erkan kolemen wrote: > Hi, > > In a daemon loop, i am using accept() to accept > incoming connections. > > while(1) { > if((fd = accept(socketd, (struct sockaddr *) &addr, > &addrlen)) == -1) { > syslog(LOG_ERR, "accept: %s", strerror(errno)); > continue; > } > else { > ... > } > > accept always fails. What is wrong? i could create > socket and i got a positive integer value as socket > descriptor. following is from syslog: > > Sep 6 17:20:50 devel pro[99227]: accept: Invalid > argument > Sep 6 17:21:20 devel last message repeated 204686 > times > > What is wrong? i am calling accept before fork().. So > i don't think child process affecting parent process. > > thanks and regards... > > - erkan > > > > > ______________________________________________________ > Click here to donate to the Hurricane Katrina relief effort. > http://store.yahoo.com/redcross-donate3/ > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"