[plt-scheme] Reading/writing atoms to TCP port

From: John Clements (clements at brinckerhoff.org)
Date: Tue Apr 4 17:44:04 EDT 2006

On Apr 4, 2006, at 2:31 PM, Scott Bell wrote:

> Hello all,
>
> I'm having some curious issues when reading and writing to a set of
> TCP ports between two MzScheme (v301) instances. I can successfully
> WRITE a list (ex: '(+ 1 5)) to an output port, flush the output, and
> successfully READ it on the other end. This also works for strings.
> However, when I try and write an atom like 6, then flush the output,
> the other end cannot READ the value until the sender closes the port,
> or another list or string is written and flushed. At which point the
> receiving end can perform two READs and receive the atom and the
> string/list.

IIUC, MzScheme's behavior seems like the right one.  If the only  
character waiting to be read in a port is a "6", there's no way for  
READ to figure out whether this is the beginning of a longer number  
or just the number 6.  After all, you might be about to put the  
characters "2687" on the port, in which case READ ought to return the  
number 62687, right?

John Clements

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20060404/23ebec12/attachment.p7s>

Posted on the users mailing list.