[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Writing statefull protocol server



Hi Eduardo,

You can pass in a context argument for your callback. That allows you do use a struct (or C++ class) of your choosing.

As an example, when I setup the callback in Metre (an XMPP server, sort of), I do this:

https://github.com/surevine/Metre/blob/master/src/netsession.cc#L88

… which means I can then dispatch the call to the right instance here:

https://github.com/surevine/Metre/blob/master/src/netsession.cc#L211

Hope this helps,

Dave.

On Fri, 3 May 2019 at 12:30, Eduardo <emorras@xxxxxxxxxx> wrote:

Hello,

I'm trying to develop a Windows FTP/FTPS server. As it's stateful protocol I
must store the session information (current server path, user ip, port, modes).

How can I know that an event comes from/goes to a specific session/connection?

All examples I checked implements stateless protocols, http, dns, echo...; Is
there any example of statefull protocol?

Thanks


--
Eduardo <emorras@xxxxxxxxxx>
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.