[Twisted-Python] about using twisted to write a RT server.

Chris chris.yan at saybot.com
Wed Apr 23 04:20:59 MDT 2008


Hi everyone,
I want to write a server,it works just like this:
1.client will connect to the server,maybe with some auth information.
2.the server verify the client,if it's ok,accept the connection.
3.the client starts to sent some binary data to server buffer by buffer
,the server will use it to calculate in real time.
4.when all the data is sent,the client will tell the server no data any
more.
5.the server gets a result from the data,and sends the result to the
client(the client is ASCII code)
6.server shuts down the connection.

first,I want to know which protocol I should use?the LineReceiver is ok
for this?

second,I know the LineReceiver protocol can switch between line mode and
row mode,I think I will use line mode to send the control command,and
use raw mode to sent the data,but how the client can inform the server
which mode should use?because sometimes the data which is received in
raw mode is exactly a legal command,but it is just only a part of the data.

third,I don't know very much about how to send the binary data,I heard I
should use struct modul,is it right?

any hint is helpful,please just give me a direction,I hope my question
will not take too much time to answer,thanks a lot.

Regards
Chris





More information about the Twisted-Python mailing list