[gambit-list] open-tcp-client won't connect to Emacs server?

James Long longster at gmail.com
Fri Oct 2 01:57:45 EDT 2009


I'm having some issues with the following scenario, and I can't figure out why.

I created a tcp server in Emacs and am trying to connect to it in
Gambit using open-tcp-client.  Here's how I create my server in Emacs:

(make-network-process :name "grime3d"
                      :buffer "*grime3d*"
                      :host "localhost"
                      :server t
                      :service 12000
                      :filter 'grime3d-client-filter
                      :log 'grime3d-server-log))

More information about `make-network-process` can be found here:
http://www.gnu.org/software/emacs/manual/html_node/elisp/Network-Processes.html

If I use telnet, everything works fine (which is why this is so odd to me):

james:~% telnet localhost 12000
Trying ::1...
Connected to localhost.
Escape character is '^]'.
one
two

However, if I use Gambit it refuses to connect:

> (define p (open-tcp-client "localhost:12000"))
> (read p)
*** ERROR IN ##read-datum-or-label-or-none-or-dot -- Connection refused
(peek-char '#<input-output-port #2 (tcp-client "localhost" 12000)>)
1>
> (define p (open-tcp-client (list port-number: 12000)))
> (read p)
*** ERROR IN ##read-datum-or-label-or-none-or-dot -- Connection refused
(peek-char '#<input-output-port #3 (tcp-client #u8(127 0 0 1) 12000)>)
1>

If I create a server in Gambit, like this, it works as expected:

---------------- process 1
> (define p (open-tcp-server "*:30000"))
> (read p)
#<input-output-port #2 (tcp-client)>
> (read p)
#<input-output-port #3 (tcp-client)>
>
---------------- process 2
> (define p (open-tcp-client "localhost:30000"))
> (define p (open-tcp-client "localhost:30000"))

So, it all points to some weird interaction between Gambit and the
Emacs server.  I've looked around and even scanned through the Emac
source for `make-network-process` and it all seems normal.  I'm not
really experienced with client-server systems though.  Am I doing
something obviously wrong?

- James



More information about the Gambit-list mailing list