Date: Thu, 22 Feb 2001 14:09:11 +0000 From: Jordan DeLong <fracture@allusion.net> To: Thierry Herbelot <thierry.herbelot@free.fr> Cc: hackers@FreeBSD.ORG Subject: Re: detecting a closing socket from a Lex/Yacc interpreter ? Message-ID: <20010222140911.A9405@cx420564-b.tucson1.az.home.com> In-Reply-To: <3A95776A.1E76A7B@free.fr>; from thierry.herbelot@free.fr on Thu, Feb 22, 2001 at 09:32:42PM %2B0100 References: <3A95776A.1E76A7B@free.fr>
next in thread | previous in thread | raw e-mail | index | archive | help
I'm assuming right now you are just setting yyin to the fd for the socket. What you're gonna want to do is define the macro YY_INPUT (see the man page for details) so that it calls recv on your socket. and then if it errors you can have YY_INPUT return as an EOF and your <<EOF>> rule will work fine. On Thu, Feb 22, 2001 at 09:32:42PM +0100, Thierry Herbelot wrote: > Hello, > > I'm currently writing a small interpreter for a client/server > application. > > the Lex and Yacc files seem to be OK, as the tests are running fine (as > long as there is only one client, and the client dos not close its > socket ...) > > I still have one problem : the server has a single thread : the process > accept()s a connection, then processes the commands (with yyparse()), > and after the current client disconnects, gets back to listening to the > socket, and so on. > > the problem is that the yyparse() function does not return when the > socket is closed. I've had a look at the sources of ftpd, where yacc is > used, but from what I've seen, the yylex() function has been hand > written (which I would like not to do) > > I've added a <<EOF>> target in the lex file, but it does not seem to > detect the socket close() > > taker for any solution, > > TfH > -- > Thierry Herbelot > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hackers" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010222140911.A9405>