Article View: news.software.nntp
Article #69670Re: POST -> no response, but message is posted.
From: Curt Welch
Date: Sun, 08 Aug 2004 16:58
Date: Sun, 08 Aug 2004 16:58
43 lines
3261 bytes
3261 bytes
Florian Zschocke <edv@zschocke-berlin.de> wrote: > Andrew - Supernews <andrew+nonews@supernews.com> wrote: > > > > > Thank you Andrew > > > >How long do you wait for it? > > > Not at all at the moment. I send the data and if that is done I read > from the socket. So this is heavy to debug - cause the failure will not > raise if I debug. That leads me to the conclusion that it is time > dependent. > So what can I do ? A generic wait will not help. I could loop until > select() gives a positive value but that will be too expensive ? As Andrew has said, it sounds like you are a bit out of your league here (i.e., still have a lot to learn). A normal socket read will hang (block the thread/processes) until the data is there. So all you have to do is read. Just don't make the mistake of assuming the entire response will always show up in a single read. You have to buffer the returned data and wait until you have the full response, ending with CR LF. So you must loop reading data until the full response shows up. The simple way to do this is to use character based IO (fgetc()). You loop reading characters into a buffer until you get the CR LF ending the line. And then you processes the response. That works fine for reading a response line, but may not be fast enough for high speed downloading of headers and articles if you are trying to write a general newsreader. If you are using ASYNC IO by setting a NONBLOCK option, then you are into a more complex programming problem. It's unlcear from your response above if you have done that, or if you have not, and are just confused by what your code is doing. If you are using ASYNC IO, then you need to use a select() with (or without) a timeout value to wait for data to show up (or to wait forever). But you still need to loop doing the select, and reading data, until the full command has shown up, because like above, you can't assume the full response will show up in a single read. -- Curt Welch http://CurtWelch.Com/ curt@kcwc.com Webmaster for http://NewsReader.Com/
Technical Details
Message-ID:
<20040808125855.840$hk@newsreader.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!number1.nntp.dca.giganews.com!internal1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!newsh.newsreader.com!ellis.newsreader.com!not-for-mailReferences:
<slrnchc18b.1pnu.andrew+nonews@trinity.supernews.net> <41160f3c$0$7309$9b4e6d93@newsread2.arcor-online.net>Show Full Headers
Complete Article Headers
Message-ID: <20040808125855.840$hk@newsreader.com>
Subject: Re: POST -> no response, but message is posted.
Date: Sun, 08 Aug 2004 16:58:55 +0000
From: curt@kcwc.com (Curt Welch)
References: <slrnchc18b.1pnu.andrew+nonews@trinity.supernews.net> <41160f3c$0$7309$9b4e6d93@newsread2.arcor-online.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!number1.nntp.dca.giganews.com!internal1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!newsh.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com 18pInP1Q0brtr4A3kfCtzMpFHDTt+V3,iyS@nI_VxSEkRTgH8j
X-Face: "p}G*1KH{+F7EYGKLb>ogDguabZ+%,
?^epeFB!nzu`)`$=QcvL1KF6<0GH!Tbc!Sqo[|tV5
%IW48mQf3K=Ci&gZ7]]aazx@]Y-nq!r5{yH/#,?@lDdUDvOfByB2hVW0.@OM%{l/{cT'{w
X-Url: http://CurtWelch.Com/
User-Agent: NewsReader.Com
Lines: 43