|
Boost Users : |
Subject: [Boost-users] getting a handle to another connection?
From: Ozgur Ozturk (ozgur7_at_[hidden])
Date: 2009-07-27 12:19:30
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?)
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.
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?
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?
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 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