Boost logo

Boost Users :

Subject: Re: [Boost-users] getting a handle to another connection?
From: Etienne Philip Pretorius (icewolfhunter_at_[hidden])
Date: 2009-07-27 12:35:30


Ozgur Ozturk wrote:
> Hi,
> I need to send ip information of a client to the other one (as they
> will connect to each other directly now).
> I used async echo server sample
> <http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/example/echo/async_tcp_echo_server.cpp>as
> a starting point.
> I guess sessions are recorded in io_service instance, since in the server
> constructor when we create session, we pass io_service to it.
> session* new_session = new session(io_service_);
> Can I get information of connected sessions from io_service?
> (or any other recommendations on how to better design it?)
>
>
Sounds like we are doing similar projects :D.

> To expand my question: I am implementing a chat server, but the chats will
> not go over the server (is it a bad idea?).
>
> many clients connects, I keep their status (online or not) in a database.
>
One of my hurdles at the moment :D
> when A wants to talk to B, I need to pass request to B, how can I get a
> handle to my connection to B while I am in the instance of session with A?
>
You need some sigslot implementation and a message queue/multi-index
view. I am planning on using this approach so that I can abstract my
server<-->server and client<-->server implementations. In other words
the "router" of my code is in pieces in the client and server classes
that will look for the class stream* (lookup via multi-index) to call to
relay the message to the appropriate agent(s). (Both classes have a base
class called stream).

YMMV...
> I am still not sure I understand io_service concept.
> Is this proactor thing similar to observer pattern? When we pass io_service
> as a parameter to something, are we registering it to be observed in
> io_service?
>
io_service = epoll/poll/select... (IO Multiplex object)

> Thanks in advance,
> (*Thanks for all the previous answers too, *I have made significant
> progress...)
>
> Best regards,
> Ozgur (Oscar) Ozturk
> www.DrOzturk.com
> Phone: +1 (908) DROZGUR
> i.e, +1 (908) 376-9487
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net