[EMAIL PROTECTED] (Ludovic Courtès) writes: > William Xu <[EMAIL PROTECTED]> writes: > >> Is the following the correct way of using `uniform-array-read!'? Seems >> it simply hangs there.. >> >> (let ((ar (make-uniform-array #\nul length))) >> (uniform-array-read! ar sockfd)) > > In your example, it can very well be hanging because there is nothing to > read from SOCKFD (e.g., it's making a blocking `read' system call > beneath).
Ooh, that was only partial of the codes. Actually i've also written the codes in C first to make sure we could *read*. > Using Guile 1.7: Not in debian yet.. Guile 1.6.7 here. > guile> (define a (make-uniform-array #\nul 10)) > guile> (uniform-array-read! a (open-input-string (string #\001 #\002 > #\003))) > 3 > guile> a > #s8(1 2 3 32 51 10 -102 96 48 10) > guile> > > IOW, it seems to work fine --- except that: > > 1. The array is not properly initialized; It is. > 2. The result is not a string as one would expect from the Guile 1.6 > manual[*] (in fact it could hardly be a string since internally > strings may not contain null characters AFAIK). What is that "result"? I noticed that in your example, guile> (uniform-array-read! a (open-input-string (string #\001 #\002 #\003))) The second argument for uniform-array-read! is a string. In my codes, i tried to read binary data, precisely, a network packet. Does this matter? [...] -- William _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user