🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #68470

Re: homebrew nntp server: outlook behaves strange!

#68470
From: Curt Welch
Date: Sun, 07 Mar 2004 17:13
43 lines
3599 bytes
Yuri Schaeffer <mikrosofty@hotmail.com> wrote:
> I Think something went wring with my reply, a repost:
>
>  > Are you by any chance going through standard IO and trying to use
> your sockets in text mode?  Don't do that, it may do the right thing
> under Windows but it will produce the wrong results under Unix.  Always
> open your streams as binary and explicity send the line ending as \r\n .
>
> The line endings where indeed the problem. (I use java btw) I use the
> println method of a PrintWriter, apperently it only uses a \n this is
> fixed now by manually add a \r.
>
> I couln't find anything about opening my Sockets in binary in the API I
> presume it is binary by default. My news-server works fine now.

When trying to port code between Windows and Unix you have to be very
careful to get this line-ending stuff correct.  It's not always easy
because the various packages you use might be converting LF to CR LF for
you on one platform but not another.

Over the network, you have to send CR LF at the end of the line.  If you
only send LF, then you get the problem you saw.  But if you send CR CR LF,
it might seem to work because articles display correctly, but you are
actually corrupting articles.  You must have the right tools to test with
to make sure you are sending exactly what you should be sending.  Outlook
express and other such newsreaders are a good first test, but it's not the
right tool to really make sure your server is doing what it should.

I don't know Java so I can't give you any advise about that.  But the point
about using a stream in binary mode was the idea that you should try to
turn off any type of automatic conversion from LF to CR LF, or CR ro CR LF
etc.  The C stdio package will do platform specific conversions of LF (unix
end of line), to CR LF, (DOS/Windows end of line), when it is in text mode
(the default).  But if you open the stream in binary mode, it disables
those platform specific conversions.  It's possible that Java has some
platform specific coversions like that as well and you should try and do
the socet IO in a way where the IO package won't try to do any platform
specific text-file conversions for you because the NNTP stream is not
platform specific - it must be the same on all platforms.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Technical Details
Message-ID: <20040307121328.680$Bb@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!intern1.nntp.aus1.giganews.com!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
References: <Zps2c.1903$pN4.1155@amsnews03.chello.com> <iMeowbot-45BFC1.18051906032004@news.supernews.com> <dKA2c.74202$KL3.7313@amsnews05.chello.com>

Show Full Headers
Complete Article Headers
Message-ID: <20040307121328.680$Bb@newsreader.com>
Subject: Re: homebrew nntp server: outlook behaves strange!
Date: Sun, 07 Mar 2004 17:13:28 +0000
From: curt@kcwc.com (Curt Welch)
References: <Zps2c.1903$pN4.1155@amsnews03.chello.com> <iMeowbot-45BFC1.18051906032004@news.supernews.com> <dKA2c.74202$KL3.7313@amsnews05.chello.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!intern1.nntp.aus1.giganews.com!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com l_eDdCBL9tv0x@++HHmKgfNDJTO/AVB0jyXEV3MSzmZ+Q7yTG
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