[Twisted-Python] writing back through open connections
Drew Smathers
drew.smathers at gmail.com
Tue Mar 4 22:29:39 MST 2008
On Tue, Mar 4, 2008 at 11:42 PM, David Welch <dwelch at umail.ucsb.edu> wrote:
> Matt,
>
> I read that howto/servers documentation and I have set up my code into
> a Factory and Protocol that handles incoming connections.
Honestly, I don't think we're dealing with a design pattern issue now.
> I don't
> think I explained myself well enough though. When a client connects,
> the server may or may not being send data back right away so I need to
> be able to send data to that connected client on the servers terms.
> For example:
>
> Client 1 connects -- Factory instantiates Protocol class to handle
> communication (connection doesn't close)
> Client 2 connects -- Factory instantiates Protocol class to handle
> communication (connection doesn't close)
> <time has passed until server decides it needs to send a plugin to one
> of the clients>
> Server sends plugin to Client 1
>
> So how can that server send data to client 1 if client 1 hasn't caused
> an event (The server side causes a certain event it should send data
> to a selected client).
Define `event'. Is the initial connection not an event? If you have
an open connection, the client doesn't have fart back through it every
5 seconds (by the semantics of most protocols) to keep it open or
anything.
> I understand that if a client sends data to the
> server I can than write back to the client using the dataReceived
> function within the Protocol instantiation.
Are you sure you understand? You're calling dataReceive to send data?
If you're calling a method (that's what you meant by "function within
the Protocol instantiation", I guess) with "receive" in the name, then
you can only be very confused.
> In this case once N number
> of agents have connected I want the server to push data to the clients
> without the Client writing to the server. Thanks again for the help.
>
So write back data to the client. That's all I can say until you
describe what you've tried (w/ code) and why it failed (w/ a
stacktrace) - vs. in pretty vague terms on essay on what you want to
do and haven't even attempted.
--
\\\\\/\"/\\\\\\\\\\\
\\\\/ // //\/\\\\\\\
\\\/ \\// /\ \/\\\\
\\/ /\/ / /\/ /\ \\\
\/ / /\/ /\ /\\\ \\
/ /\\\ /\\\ \\\\\/\
\/\\\\\/\\\\\/\\\\\\
d.p.s
More information about the Twisted-Python
mailing list