Skip to content

Latest commit

 

History

History
70 lines (46 loc) · 1.63 KB

README.rst

File metadata and controls

70 lines (46 loc) · 1.63 KB

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.