When I do:

1)Write this code: in Dr. Racket:

#lang racket
(define server (tcp-listen 12345))
(define-values (s-in s-out) (tcp-accept server))

2)Ctrl+R
- DrRacket waits(lock the REPL) for connections

3)Write this code in python:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 12345))
- DrRacket unlock the REPL
4)s.send("hello") #in Python
5)(read-line s-in) ;in Racket
- Racket doesn't read "hello", it locks the REPL.

Help me please...

best regards,

Alejandro

El 2014-04-22 22:34, Danny Yoo escribió:
This should just work.


Can you show what code you're doing?


For example, given the following echo-server written in Racket,

;;;;;;;;;;;;;;;;;;;;
#lang racket
(define listener (tcp-listen 12345))
(let echo-server ()
  (define-values (in out) (tcp-accept listener))
  (thread (λ () (copy-port in out) (close-output-port out)))
  (echo-server))
;;;;;;;;;;;;;;;;;;;;



then the following interaction in Python shows that this is doing something:

###########################################
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 12345))
s.send("hello")
5
s.recv(500)
'hello'
###########################################

--

Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to