For Programmers: Free Programming Magazines  


Home > Archive > Scheme > May 2004 > Re: NNTP open-news-group expects type <string or input-port> as 2nd









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: NNTP open-news-group expects type <string or input-port> as 2nd
Mark Carter

2004-05-12, 9:12 pm

Bruce Butterfield wrote:
> Mark Carter <cartermark46@ukmail.com> wrote in message news:<2g45ilF4bqobU1@uni-berlin.de>...


> I am not having any problems connecting to (for instance) the news
> group "comp.lang.scheme" on the news server "humboldt.nl.linux.org"
> using that exact code. I suspect you aren't actually getting a
> connection to "dali" (try using a fully qualified server name,
> perhaps?).


Thanks. I tried something similar to your suggestion (sw.urls.summaries
on urls.sytes.net)- and it works! It doesn't appear to like "dali",
though - which is my own machine. Didn't like "localhost" or "127.0.0.1"
either. Like I say, I think I've got my nntp server set up correctly
because python connects to it fine.

Oh well, I think I'd better stick to python. Thanks for the help anyway.
Mark Carter

2004-05-12, 9:12 pm

Mark Carter wrote:

> either. Like I say, I think I've got my nntp server


.... which is Hamster; I'm using the evil Windows platform.
Mark Carter

2004-05-12, 9:12 pm

MJ Ray wrote:

> Mark Carter <cartermark46@ukmail.com> wrote:
>
>
> You could try asking on plt-scheme whether anyone can reproduce this problem,
> as I can't. Then again, I'm not using your "evil" platform.


Thanks, I'll have a go.

[color=darkred]
> You are a troll AICM5P.


I protest, sir!

I admit I'm a newbie to Scheme - and I think learning it is quite an
uphill struggle. Python is much easier to get into, seriously. I mean, I
decided to have a try at MIT Scheme a couple of days ago. There was no
way it would run without invoking edwin (on Windows) - which, I have to
say, is IMHO a honking pile of garbage. I mean, Python's Idle may be
somewhat minimalistic, but it's better than edwin.

I suspect that things are a lot better for Unix users than they are for
Windows, though.

Maybe Scheme needs more "hobbyists" than academics.

Now, where did I put that asbestos suit.
Mark Carter

2004-05-12, 9:12 pm

>>The problem is in open-news-group

> Ignoring the semi-flame, the problem seems to be with the way your
> server interacts with the plt code, shutting the connection instead of
> an expected status line. It might be helpful to trace the tcp port
> and see if there is anything wrong. If you do this and find that your
> server is responding fine but the plt code is somehow not doing things
> correctly, then please file a bug report.


Thanks ... but I have already written a fair amount of code that does
what I want in python. I had wanted to experiment with Scheme to see how
easy/difficult it would be to get something going (I think you can guess
my conclusion). From my point of view, tracing tcp ports and stuff is a
game that's not worth the candle, esp. when I've already got something
working in Python.

This message is not intended to be a flame, or a rebuff.
Jens Axel Søgaard

2004-05-12, 9:12 pm

Mark Carter wrote:

> Thanks ... but I have already written a fair amount of code that does
> what I want in python. I had wanted to experiment with Scheme to see how
> easy/difficult it would be to get something going


Understood. You just have to be careful who you blame for the trouble.
It is not the Scheme /language/ per se. You experienced problems
using a specific library in connection with a specific news server
(i.e. Hamster). Eli fixed a wrong error message in the library but
it still remains unclear whether the trouble stems from the library
or from Hamster.

> From my point of view, tracing tcp ports and stuff is a game that's
> not worth the candle, esp. when I've already got something working
> in Python.


Aren't you curious? *Why* doesn't it work? And if there is an error
wouldn't it be a nice to help fix things, so the next person will
have a better experience.


A simple interaction using telnet between a user and the Hamster
server would probably be helpful. Alternatively you might
consider helping Eli by letting him telnet to your nntp-server.

--
Jens Axel Søgaard
Mark Carter

2004-05-12, 9:12 pm

> From this and other messages you sent, It sounds like you were
> considering playing with Scheme instead of playing with Python. From
> the above, it looks like your conclusion is that you should stick with
> Python. Given that your stated goal was to experiment with Scheme,
> either your conclusion is unjustified, or you retroactively classify
> yourself as a troll.


Blimey.

I've decided that my priorities will be to get the stuff that I want
working done in Python first. Later (maybe), I'll investigate what's
going on in Scheme with a view to seeing who right, who's wrong, and
what can be done about it.

I do have a real job, this is just a hobby.

Can we all agree to shake hands like gentlemen on this?
Mark Carter

2004-05-12, 9:12 pm

[color=darkred]

Also worth a mention is the fact that Thunderbird seems to connect to
Hamster perfectly fine, too.

Unfortunately, it would not be possible for outsiders to connect to my
server. The server that I have running at work is behind a firewall; and
the one I have at home just uses a dialup account, so it wouldn't be
practical for people to access it.
Mark Carter

2004-05-12, 9:12 pm

Eli Barzilay wrote:
> Mark Carter <cartermark46@ukmail.com> writes:


>
>
> And the plt-scheme nntp thing fails with both?


If you mean the office as well as home, then the answer is ... I haven't
tried.

If you mean Hamster as well as Thunderbird, then the answer is ...
Thunderbird is a newsreader, so plt-scheme wouldn't work with it, nor
would one expect it to.


By which I mean external to the firewall/my home.
[color=darkred]
> Should be practical for debugging the problem.


Alas, it's a technical limitation which is unlikely to change in the
foreseeable future.

Python allows one to set a high debug level for NNTP, so it should be
possible for me to get a precise description of what Hamster is spitting
out. However, it's not a priority for me right now.

Terrence Brannon, Scheme Hacker

2004-05-12, 9:12 pm

Mark Carter wrote:

> I admit I'm a newbie to Scheme - and I think learning it is quite an
> uphill struggle. Python is much easier to get into, seriously. I mean, I
> decided to have a try at MIT Scheme a couple of days ago.


try DrScheme:

http://www.drscheme.com
Mark Carter

2004-05-12, 9:12 pm

Terrence Brannon, Scheme Hacker wrote:
> try DrScheme:
> http://www.drscheme.com


That's what I was trying with my NNTP thing.
Joe Marshall

2004-05-12, 9:12 pm

Mark Carter <cartermark46@ukmail.com> writes:

> I admit I'm a newbie to Scheme - and I think learning it is quite an
> uphill struggle. Python is much easier to get into, seriously. I mean,
> I decided to have a try at MIT Scheme a couple of days ago. There was
> no way it would run without invoking edwin (on Windows) - which, I
> have to say, is IMHO a honking pile of garbage. I mean, Python's Idle
> may be somewhat minimalistic, but it's better than edwin.


Edwin is a damn good, if minimal, Emacs-like editor and many people
put a lot of time into it. However, if you are expecting a simple
command line, I can see that Edwin would not meet your expectations.

MIT-Scheme can run on Windows without Edwin. I do it all the time.
If you look at the `shortcut' you use to launch Scheme, you will see
that it has the flag `-edit' in the command line. Simply remove this
flag and Scheme will not launch Edwin on startup.
Karl Pflästerer

2004-05-12, 9:12 pm

On 10 May 2004, Eli Barzilay <- eli@barzilay.org wrote:

> Mark Carter <cartermark46@ukmail.com> writes:


[color=darkred]

In your Python example you logged in as user guest. Here you don't log
in.

It seems the nntp lib doesn't have a procedure to log in.
[color=darkred]
> This is a bug in the code, where it assumes that it gets a string and
> your server slams the door instead. I fixed it in cvs, but using the
> fix just means that you'll get a better error message.


The problem seems to me the line end which gets send to the server. I
have here Hamster also running and saw (if I'm not wrong) that the nntp
lib uses fprintf to format the output. A newline is written as `~n'. I
don't know at the moment what exactly gets send (a cr a nl or crnl) but
it seems to be the wrong one.

I made a little test with Hamster and a TCP connection. I ran the code
in mzscheme interactively (it is the Windows version; if it's simple to
compile a Cygwin version with full GUI support I'll use that in future)

****************************************
****************************
> (call-with-values

(lambda () (tcp-connect "127.0.0.1" 119))
(lambda (in out)
(if (char-ready? in) (read-line in))
(display "help" out) (newline out)
(if (char-ready? in)
(read-line in)
(begin
(display "No response")
(newline)))))
No response
> (call-with-values

(lambda () (tcp-connect "127.0.0.1" 119))
(lambda (in out)
(if (char-ready? in) (read-line in))
(fprintf out "~a~n" "help")
(if (char-ready? in)
(read-line in)
(begin
(display "No response")
(newline)))))
No response
> (call-with-values

(lambda () (tcp-connect "127.0.0.1" 119))
(lambda (in out)
(if (char-ready? in) (read-line in))
(display "help\r\n" out)
(if (char-ready? in)
(read-line in)
(begin
(display "No response")
(newline)))))

"100 Implemented commands follow:\r"
****************************************
****************************

So you see (I could show you also the server log) that the server only
saw the sent value when it was ended with "\r\n". I think here lies the
problem. So in Mark's case the server waited after the connection for
the next command but never saw it (since the server waited for "\r\n")
and after some seconds (the default is 10) it closed the connection. So
the server just closes the door and doesn't send a response since it
thinks there's no connection.

The next problem for Mark would have been that he didn't log in the
server. He would have got a response that he has to authenticate first
Here is the same with telnet.

****************************************
****************************
$ telnet 127.0.0.1 119
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
200 NNTP-Server Classic Hamster Version 2.0 (Build 2.0.5.1) (post ok) on wintendo.pflaesterer.de says: Hi!
group internal.misc
480 Authentication required
quit
205 Closing connection.
Connection closed by foreign host.
****************************************
****************************

[color=darkred]
[color=darkred]

Here Mark uses a guest account.

[...]
[color=darkred]
> Ignoring the semi-flame, the problem seems to be with the way your
> server interacts with the plt code, shutting the connection instead of
> an expected status line. It might be helpful to trace the tcp port


I showed above why I think the server is right.

> and see if there is anything wrong. If you do this and find that your
> server is responding fine but the plt code is somehow not doing things
> correctly, then please file a bug report. (It's a much more effective


I don't know if I should send a bug report (I think it's a bug but on
the other hand that code must have worked for a lot of people).



KP

--
`Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware the Jubjub bird, and shun
The frumious Bandersnatch!' "Lewis Carroll" "Jabberwocky"
Matthias Felleisen

2004-05-12, 9:12 pm

Karl Pflästerer wrote:

> On 10 May 2004, Eli Barzilay <- eli@barzilay.org wrote:
>
>
>
> I showed above why I think the server is right.
>
>
>
>
> I don't know if I should send a bug report (I think it's a bug but on
> the other hand that code must have worked for a lot of people).


We have recently experienced problems with MS-based servers (for different
things) that eventually turned out to be bugs in the server code but other tools
had already worked around MS's mis-implementation of an RFC.

If this is the case here, Python just propagates the dominance of MS.

If not, we would love to receive a bug report. Thanks for putting in the work.

-- Matthias

Karl Pflästerer

2004-05-12, 9:13 pm

On 10 May 2004, Matthias Felleisen <- matthias@ccs.neu.edu wrote:

> Karl Pflästerer wrote:


[Problems from another poster with nntp lib and Hamster]

> If not, we would love to receive a bug report. Thanks for putting in the work.


Done. I hope everything's clear. I looked in rfc977 and found the
following:

,----[ RfC 977 Network News Transfer Protocol ]
| 2.3. Commands
|
| Commands consist of a command word, which in some cases may be
| followed by a parameter. Commands with parameters must separate the
| parameters from each other and from the command by one or more space
| or tab characters. Command lines must be complete with all required
| parameters, and may not contain more than one command.
|
| Commands and command parameters are not case sensitive. That is, a
| command or parameter word may be upper case, lower case, or any
| mixture of upper and lower case.
|
| Each command line must be terminated by a CR-LF (Carriage Return -
| Line Feed) pair.
`----

So Hamster (the server) is right if he insists on crlf ended commands.


KP

--
"But it has nothing to do with what a _value_ is. This has to do with
whether you pass whatever-a-value-is or wherever-whatever-is-a-value-is
whenever you pass an argument to a function. (Call it the Shakira
theory. :)" [Erik Naggum in cllisp über call-by-value und call-by-reference]
Jeffrey M. Vinocur

2004-05-12, 9:13 pm

In article <m3u0yoni42.fsf@hamster.pflaesterer.de>,
Karl Pflästerer <sigurd@12move.de> wrote:
>
>Done. I hope everything's clear. I looked in rfc977 and found the
>following: [...]
>
>So Hamster (the server) is right if he insists on crlf ended commands.


FYI, RFC 977 is extraordinarily out of date; the very-soon-to-be
new standard is presently:

http://www.ietf.org/internet-drafts...ext-base-22.txt

But you were correct; like all the other command/response
internet protocols I can think of, NNTP done correctly is CRLF
delimited even between unix machines.

Of course, in the spirit of "be stringent in what you generate
but liberal in what you accept," some servers will do fine with a
client that sends incorrect line endings.


--
Jeffrey M. Vinocur * jmv16@cornell.edu
http://www.people.cornell.edu/pages/jmv16/
Karl Pflästerer

2004-05-12, 9:13 pm

On 11 May 2004, Jeffrey M. Vinocur <- jmv16@cornell.edu wrote:

> In article <m3u0yoni42.fsf@hamster.pflaesterer.de>,
> Karl Pflästerer <sigurd@12move.de> wrote:


[color=darkred]
[color=darkred]
> FYI, RFC 977 is extraordinarily out of date; the very-soon-to-be
> new standard is presently:


> http://www.ietf.org/internet-drafts...ext-base-22.txt


Thanks. RfC may be very old (1986) but it's still proposed standard and
I fear it will last some more time till we get something like the above
mentioned draft.

> But you were correct; like all the other command/response
> internet protocols I can think of, NNTP done correctly is CRLF
> delimited even between unix machines.


> Of course, in the spirit of "be stringent in what you generate
> but liberal in what you accept," some servers will do fine with a
> client that sends incorrect line endings.


Well that spirit should first be followed by the client so it sends
correct data. The "be conservative in what you send and liberal in what
you accept" overdone gave us e.g. a lot of broken HTML, since browsers
accept nearly everything. But that's OT here so I'll set a fup2p.


KP

fup2: poster
--
Roses are red,
Violets are blue,
I'm schizophrenic...
And I am too.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com