Re: [as-devel] read() on a socket in *BSD

Frederick Bruckman (fb@enteract.com)
Wed, 16 Jun 1999 10:21:24 -0500 (CDT)


On Tue, 15 Jun 1999, Ethan wrote:

> Can anyone tell me why I seem to lose the first byte sent to AS via the 
> socket if I set non-blocking in module_accept() and never change it back 
> to blocking in FlushQueue() (with this patch installed)?  Animate and 
> Gnome seem to load and work, but when I try Wharf or Pager, the first 
> byte of the window in the SET_NAME command never arrives.  The rest of 
> the packet makes the transfer fine.

+  /* need to be able to read in command */
+  if (module_ibuf_len[channel] < sizeof (Window) + sizeof (int) + size + 1 + sizeof (int))
                                                                          ^
+    {
+      module_ibuf_len[channel] = sizeof (Window) + sizeof (int) + size + 1 + sizeof (int);
                                                                          ^
+      module_ibuf[channel] = realloc(module_ibuf[channel], module_ibuf_len[channel]);

SendInfo() doesn't send the null string terminator. (You have to add
it to the command nonetheless.) Wharf and Pager are probably sending
multiple commands fast enough to use the same connection, so the first
byte of the next command gets eaten.