Skip to content

Curionet is an asynchronous high-level networking framework, built on top of the Curio concurrency library.

License

Notifications You must be signed in to change notification settings

cmarshall108/curionet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Curionet

An asynchronous high-level networking framework built on top of the Curio library.

Examples

A simple tcp server example:

from curionet import network

class ExampleHandler(network.NetworkHandler):
    """
    An example connection handler derived from NetworkHandler
    """

    async def handle_connected(self):
        print ('Connected.')

    async def handle_received(self, data):
        print ('Data recieved from (%s: %r)!' % (self.address, data))

    async def handle_disconnected(self):
        print ('Disconnected.')

if __name__ == '__main__':
    factory = network.NetworkFactory('0.0.0.0', 8080, ExampleHandler)
    factory.run()

A simple tcp connection example:

from curionet import network

class ExampleConnector(network.NetworkConnector):
    """
    An example connector derived from NetworkConnector
    """

    async def handle_connected(self):
        print ('Connected.')

    async def handle_received(self, data):
        print ('Data recieved from server (%s: %r)!' % (self.address, data))

    async def handle_disconnected(self):
        print ('Disconnected.')

if __name__ == '__main__':
    connector = ExampleConnector('127.0.0.1', 8080)
    connector.run()

Other Resources

  • Curio, The asynchronous networking library written by David Beazley

Contributors

  • Caleb Marshall (Anythingtechpro)

About

Curionet was inspired by the Twisted Matrix framework, and was implemented using the Curio library.