ChezScheme icon indicating copy to clipboard operation
ChezScheme copied to clipboard

Fixing Section 4.9 Example: Socket Operations in the Chez Scheme User's Guide for Version 9.5.8

Open namin opened this issue 2 years ago • 1 comments

It seems at least like the client code (sample session) doesn't match the library.

I get the error:

Exception in c-write: invalid foreign-procedure argument "(let ((x 3)) x)\n"

I changed the c-write signature in the socket library in Scheme to take utf-8 instead of u8*, and also adjusted the other parameters to match the C code.

When using c-read, I need to pass in a mutable buffer, so I do that in the client code.

In the client code, I provide the start parameter as 0 both when calling c-write and c-read.

I also commented out the first get, which seems blocking.

You can see the diff here: https://github.com/namin/chezscheme-socket/commit/d4c7bfac6a108bb513d7af81c001adfd455df558

Thanks.

namin avatar Jun 15 '23 01:06 namin

A more up-to-date version of that example can be found in examples/socket.ss.

jltaylor-us avatar Jun 16 '23 23:06 jltaylor-us