chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] tcp-connect problem


From: Reed Sheridan
Subject: [Chicken-users] tcp-connect problem
Date: Wed, 10 Aug 2005 01:34:43 -0500

Hello,

I'm having problems with tcp-connect - it does something like this
when you connect to a port with no listener:

#> (define-values (i o) (tcp-connect "localhost" 81))
#> (char-ready? i)
#t
#> (read i)
Error: can not read from socket - Connection refused: 6
#> (write "hi" o)

Process scheme broken pipe


I tracked down the problem -  man connect says:

After select indicates writability, use getsockopt(2) to read the
              SO_ERROR option at level SOL_SOCKET to determine whether
connect completed successfully (SO_ERROR is zero) or  unsuccess-
              fully (SO_ERROR is one of the usual error codes listed
here, explaining the reason for the failure).

Chicken isn't doing this.  I'm not much of a C coder, but I've written
a patch to correct this anyway (see attachment).  It even works.

Reed Sheridan

Attachment: tcp.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]