Strange errors in network

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Strange errors in network

Maciej Piechotka
I have problems with my nntp library (http://code.haskell.org/nntp/). If
I try to list command it seems to fail.

Test code:
> (c,p) <- connectToHost "news.example.com" Nothing
> forGroups c (System.IO.putStrLn . groupName)
*** Exception: <socket: 6>: Data.ByteString.hGetLine: end of file

Conncection by telnet (according to wireshark):
-> SYN
<- SYN, ACK
-> ACK
<- NNTP Helo Message
-> ACK

Connection by Haskell:
-> SYN
<- SYN ACK
-> ACK
<- NNTP Helo Message
-> ACK
<- FIN ACK (after 10 s)
-> ACK

If I try to run by hand the commands in ghci I get mixed results
(sometimes works sometimes it fails).

What's wrong?
PS. example.com is an example, non-existing domain. It is specified by a
RFC to be an example domain.
PPS. As I'm not subscribe the list please CC me
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/beginners/attachments/20090612/eb862c19/attachment.bin
Reply | Threaded
Open this post in threaded view
|

Re: Strange errors in network

Maciej Piechotka
On Sat, 2009-06-13 at 02:01 +0200, Maciej Piechotka wrote:

> I have problems with my nntp library (http://code.haskell.org/nntp/). If
> I try to list command it seems to fail.
>
> Test code:
> > (c,p) <- connectToHost "news.example.com" Nothing
> > forGroups c (System.IO.putStrLn . groupName)
> *** Exception: <socket: 6>: Data.ByteString.hGetLine: end of file
>
> Conncection by telnet (according to wireshark):
> -> SYN
> <- SYN, ACK
> -> ACK
> <- NNTP Helo Message
> -> ACK
>
> Connection by Haskell:
> -> SYN
> <- SYN ACK
> -> ACK
> <- NNTP Helo Message
> -> ACK
> <- FIN ACK (after 10 s)
> -> ACK
>
> If I try to run by hand the commands in ghci I get mixed results
> (sometimes works sometimes it fails).

Apparently I needed to flush the stream despite having line buffering.

Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/beginners/attachments/20090615/7548a700/attachment.bin