[Top][All Lists]

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

Re: [help-serveez] Using detect-proto

From: stefan
Subject: Re: [help-serveez] Using detect-proto
Date: Tue, 23 Mar 2004 19:57:29 +0100 (CET)

On 22 Mar 2004, Roland Besserer wrote:

> I hope somebody can shed some light on this so I don't have to dig into
> the sources :-)

I'll try.

> I'm trying to use detect-proto on initial client connections to store a
> version id (transmitted by the client as its initial string) of a newly
> connecting client.
> Unfortunately, detect-proto seems to work different from what I expected.
> When detect-proto is called after a new client has connected to the server,
> the receive buffer is always empty. That's not very helpful.
> I was under the impression that serveez would call detect-proto once at least
> a byte of data has been received by the client (even better, once
> specific # of bytes have been received) and the manual mentions a magic
> 16 bytes. Alas, everything I try results in (svz:sock:receive-buffer-size)
> indicating 0 bytes in the receive buffer when I call it in detect-proto.
> What am I missing?

The detect-proto callback is run whenever the related socket gets somehow
notified.  This also includes the plain connect.  That is why you need
also to ensure that the receive-buffer-size is larger or equal your
version id length in the detect-proto callback.  Return 0 if not, return
-1 if the version id is there *and* the size is correct.

The magic 16 byte you mentioned is the default value for the case that
there remained data passed to detect-proto without being detected.  This
means by default your version id must not be longer than 16 bytes.

You can also have a look at the guile-servers which are included in

Hope this helps and thanks for using Serveez,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]