tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: datagram vs stream sockets



  I have hit a problem with perfused(8) developement. This daemon talks
  with FUSE filesystems over a socket, currently of SOCK_STREAM type.
  Every time the kernel issue a filesystem operation, perfused(8) will
  produce a frame containing a FUSE operation and send it over the socket.

  On the FUSE filesystem end, read() is used to read frames, using a huge
  length parameter. If perfused sends frames faster than the filesystem
  consumes them, then multiple frames will be readen at once, and the
  filesystem will  discard anything beyond the first one. Discarded frames
  get no reply at all, producing a hang in the process that caused the
  file operation.

Does the frame have a fixed-length (more or less) part at the beginning
that has a length in it?  It seems obvious that it should, and that the
way to read on a stream-type socket is to do multiple reads with the
size of the header - bytes read so far until the header is read, and
then calculate the data size, and then loop reading data_size -
data_bytes_read until all data is read, and then continue.

Attachment: pgpWP0_gqu5vC.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index