multithreading - Handling background network operations in Python -
let me preface saying i'm not entirely familiar python, have plenty of experience programming in other languages.
i'm working on tool allows me inject packets tcp network stream. idea code acts transparent proxy between 2 network endpoints. i've got code working such proxy works, , can parse packets , automate injection (i.e. detect particular state , modify / inject packets), end goal involve user interaction.
what i'm trying work out how can go having network stuff run in background, whilst command line interface prompts user commands. when command given, might perform kind of injection.
in c# i'd handle background worker task or thread, have cli trigger events, i'm not familiar how kind of design implemented in python. how should approach this?
if you're familiar pattern of having background process , triggering events, take same approach in python. take @ multiprocessing module create background process (thus avoiding global intepreter lock issue) , use pipe send messages background process trigger events
alternatively take @ package such trellis take event driven approach, or perhaps teh twisted framework. can't speak either of these though have never used them.
hope helps!
Comments
Post a Comment