|
| 1 | +## XAsyncSockets is a little but full library of managed asynchronous sockets. |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +#### Very easy to integrate and very light with one file only : |
| 6 | +- `"XAsyncSockets.py"` |
| 7 | + |
| 8 | +#### XAsyncSockets features : |
| 9 | +- Managed asynchronous sockets (in pool) |
| 10 | +- Works directly with I/O |
| 11 | +- Support for a very large number of simultaneous connections |
| 12 | +- Support for concurrent processing (threaded) |
| 13 | +- Implementation of TCP server |
| 14 | +- Implementation of TCP client |
| 15 | +- Implementation of UDP datagrams sender/receiver |
| 16 | +- Really robust and very fast |
| 17 | +- Easy to use |
| 18 | + |
| 19 | +### *XAsyncSockets* classes : |
| 20 | + |
| 21 | +| Class name | Description | |
| 22 | +| - | - | |
| 23 | +| XAsyncSocketsPool | Managed pool of 'XAsyncSocket' objects | |
| 24 | +| XClosedReason | Enumerator of 'XAsyncSocket' closing reasons | |
| 25 | +| XAsyncSocket | Abstract class of managed asynchronous sockets | |
| 26 | +| XAsyncTCPServer | TCP server implementation of 'XAsyncSocket' | |
| 27 | +| XAsyncTCPClient | TCP client implementation of 'XAsyncSocket' | |
| 28 | +| XAsyncUDPDatagram | UDP sender/recever implementation of 'XAsyncSocket' | |
| 29 | +| XBufferSlot | Managed buffer | |
| 30 | +| XBufferSlots | Managed buffers collection | |
| 31 | + |
| 32 | +### *XAsyncSockets* exceptions : |
| 33 | + |
| 34 | +| Class name | Description | |
| 35 | +| - | - | |
| 36 | +| XAsyncSocketsPoolException | Exception class for 'XAsyncSocketsPool' | |
| 37 | +| XAsyncSocketException | Exception class for 'XAsyncSocket' | |
| 38 | +| XAsyncTCPServerException | Exception class for 'XAsyncTCPServer' | |
| 39 | +| XAsyncTCPClientException | Exception class for 'XAsyncTCPClient' | |
| 40 | +| XAsyncUDPDatagramException | Exception class for 'XAsyncUDPDatagram' | |
| 41 | + |
| 42 | +### *XAsyncSocketsPool* class details : |
| 43 | + |
| 44 | +| Method | Arguments | |
| 45 | +| - | - | |
| 46 | +| Constructor | None | |
| 47 | +| AsyncWaitEvents | `threadsCount=0` (int) | |
| 48 | +| StopWaitEvents | None | |
| 49 | + |
| 50 | +( Do not call directly the methods `AddAsyncSocket`, `RemoveAsyncSocket`, `NotifyNextReadyForReading` and `NotifyNextReadyForWriting` ) |
| 51 | + |
| 52 | +### *XClosedReason* class details : |
| 53 | + |
| 54 | +| Static variable | Value | |
| 55 | +| - | - | |
| 56 | +| Error | 0x00 | |
| 57 | +| ClosedByHost | 0x01 | |
| 58 | +| ClosedByPeer | 0x02 | |
| 59 | +| Timeout | 0x03 | |
| 60 | + |
| 61 | +### *XAsyncSocket* class details : |
| 62 | + |
| 63 | +| Method | Arguments | |
| 64 | +| - | - | |
| 65 | +| GetAsyncSocketsPool | None | |
| 66 | +| GetSocketObj | None | |
| 67 | +| Close | None | |
| 68 | + |
| 69 | +| Property | Details | |
| 70 | +| - | - | - | |
| 71 | +| OnClosed | Get or set an event of type f(closedReason) | |
| 72 | +| State | Get or set object | |
| 73 | + |
| 74 | +### *XAsyncTCPServer* class details : |
| 75 | + |
| 76 | +| Method | Arguments | |
| 77 | +| - | - | |
| 78 | +| Create (static) | `asyncSocketsPool`, `srvAddr` (tuple of ip and port), `srvBacklog=256` (int), `recvBufSlots=None` | |
| 79 | + |
| 80 | +| Property | Details | |
| 81 | +| - | - | - | |
| 82 | +| SrvAddr | Tuple of ip and port | |
| 83 | +| OnClientAccepted | Get or set an event of type f(xAsyncTCPServer, xAsyncTCPClient) | |
| 84 | + |
| 85 | +### *XAsyncTCPClient* class details : |
| 86 | + |
| 87 | +| Method | Arguments | |
| 88 | +| - | - | |
| 89 | +| Create (static) | `asyncSocketsPool`, `srvAddr`, `connectTimeout=5`(int), `recvbufLen=4096`(int) | |
| 90 | +| AsyncRecvLine | `timeoutSec=None` (int) | |
| 91 | +| AsyncRecvData | `size=None` (int), `timeoutSec=None` (int) | |
| 92 | +| AsyncSendData | `data` (bytes or buffer protocol) | |
| 93 | + |
| 94 | +| Property | Details | |
| 95 | +| - | - | - | |
| 96 | +| SrvAddr | Tuple of ip and port | |
| 97 | +| CliAddr | Tuple of ip and port | |
| 98 | +| OnFailsToConnect | Get or set an event of type f(xAsyncTCPClient) | |
| 99 | +| OnConnected | Get or set an event of type f(xAsyncTCPClient) | |
| 100 | +| OnLineRecv | Get or set an event of type f(xAsyncTCPClient, line) | |
| 101 | +| OnDataRecv | Get or set an event of type f(xAsyncTCPClient, data) | |
| 102 | +| OnCanSend | Get or set an event of type f(xAsyncTCPClient) | |
| 103 | + |
| 104 | +### *XAsyncUDPDatagram* class details : |
| 105 | + |
| 106 | +| Method | Arguments | |
| 107 | +| - | - | |
| 108 | +| Create (static) | `asyncSocketsPool`, `localAddr=None` (tuple of ip and port), `recvbufLen=4096`(int), `broadcast=False`(bool) | |
| 109 | +| AsyncSendDatagram | `datagram` (bytes or buffer protocol), `remoteAddr` (tuple of ip and port) | |
| 110 | + |
| 111 | +| Property | Details | |
| 112 | +| - | - | - | |
| 113 | +| LocalAddr | Tuple of ip and port | |
| 114 | +| OnRecv | Get or set an event of type f(xAsyncUDPDatagram, remoteAddr, datagram) | |
| 115 | +| OnFailsToSend | Get or set an event of type f(xAsyncUDPDatagram, datagram, remoteAddr) | |
| 116 | +| OnCanSend | Get or set an event of type f(xAsyncUDPDatagram) | |
| 117 | + |
| 118 | +### *XBufferSlot* class details : |
| 119 | + |
| 120 | +| Method | Arguments | |
| 121 | +| - | - | |
| 122 | +| Constructor | `size` (int), `keepAlloc=True`(bool) | |
| 123 | + |
| 124 | +| Property | Details | |
| 125 | +| - | - | - | |
| 126 | +| Available | Get or set the availability of the slot | |
| 127 | +| Size | Get the buffer size of the slot | |
| 128 | +| Buffer | Get the buffer of the slot | |
| 129 | + |
| 130 | +### *XBufferSlots* class details : |
| 131 | + |
| 132 | +| Method | Arguments | |
| 133 | +| - | - | |
| 134 | +| Constructor | `slotsCount`(int), `slotsSize`(int), `keepAlloc=True`(bool) | |
| 135 | +| GetAvailableSlot | None | |
| 136 | + |
| 137 | +| Property | Details | |
| 138 | +| - | - | - | |
| 139 | +| SlotsCount | Get the number of slots | |
| 140 | +| SlotsSize | Get the buffer size of each slots | |
| 141 | +| Slots | Get the list of slots | |
| 142 | + |
| 143 | +### By JC`zic for [HC²](https://www.hc2.fr) ;') |
| 144 | + |
| 145 | +*Keep it simple, stupid* :+1: |
0 commit comments