-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
curionet: added a network connector for managing single client connec…
…tions
- Loading branch information
1 parent
d169f14
commit bf0e850
Showing
3 changed files
with
106 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
* Copyright (C) Caleb Marshall and others... - All Rights Reserved | ||
* Written by Caleb Marshall <anythingtechpro@gmail.com>, May 23rd, 2017 | ||
* Licensing information can found in 'LICENSE', which is part of this source code package. | ||
""" | ||
|
||
from curionet import network | ||
|
||
class ExampleConnector(network.NetworkConnector): | ||
""" | ||
An example connector derived from NetworkConnector | ||
""" | ||
|
||
async def handle_connected(self): | ||
print ('Connected.') | ||
|
||
# send the server some data... | ||
await self.handle_send('Hello World!') | ||
|
||
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__': | ||
connector = ExampleConnector('127.0.0.1', 8080) | ||
connector.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters