Skip to content

Instantly share code, notes, and snippets.

@frymaster
Created April 3, 2014 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frymaster/9955183 to your computer and use it in GitHub Desktop.
Save frymaster/9955183 to your computer and use it in GitHub Desktop.
Problem statement

I'm new to twisted, and I'm having trouble working out how I should organise my code. The client that connects to a TCP(SSL) control channel and then will try to connect to the same IP:port on UDP for a low-latency data channel, based on encryption settings provided over TCP. If it can't, the TCP control channel will be used for the data. I'd like to write a reusable client such that people can override a class with functions such as dataReceived, controlMessageXReceived, sendControlMessageX, sendDataMessage etc, with whether the UDP channel is in use or not abstracted away into my code.

I currently have a Protocol that can understand the TCP control channel; for testing purposes I've overridden ConnectionMade() there to send set-up messages and confirm everything works (it can understand the server and vice versa)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment