This is the mail archive of the guile@cygnus.com mailing list for the guile project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
I hope sombeody can give me some help or ideas where to look, before
this drives me up the wall.
I am trying to implement some scheme code to communicate with a server
using some binary protocol. The communication is performed over a
socket, created with.
(socket AF_INET SOCK_STREAM 0)
The protocol needs me to open the socket send a 22 byte header, and
receive a 22 byte header in response, to initialize the connection
with the server. This works fine.
In order to shut down the connection, I shall again send a 22 byte
header, but for mysterious reasons, guile insists on sending an extra
null byte first, of course completely destroying the
communication. Here is a syscall trace displaying the problem:
write(1, " g u i l e > ", 7) = 7
read(0, " ( u n i f o r m - a r r".., 5120) = 43
* write(5, "\0", 1) = 1
* write(5, "03\0\00503\0070E M\003 ".., 22) = 22
write(1, " 2 2\n", 3) = 3
write(1, " g u i l e > ", 7) = 7
read(0, " ( u n i f o r m - a r r".., 5120) = 43
** write(5, "03\0\00503\0070E M\003 ".., 22) = 22
write(1, " 2 2\n", 3) = 3
write(1, " g u i l e > ", 7) = 7
The two lines marked with a star, shows the problem. First a null byte
(which should not be there) is written, and then my 22 byte header is
written.
The funny thing that if I do a second write (the double star), no
spurious null byte is written.
I am using `display' (though in this example it was `uniform-array-write').
The version of guile is late march snapshot.
I am running on a i386-pc-solaris2.5.1 machine.
Any help or idea is greatly appreciated.
---------------------------+--------------------------------------------------
Christian Lynbech | Telebit Communications A/S
Fax: +45 8628 8186 | Fabrik 11, DK-8260 Viby J
Phone: +45 8628 8177 + 28 | email: chl@tbit.dk --- URL: http://www.telebit.dk
---------------------------+--------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
- petonic@hal.com (Michael A. Petonic)