Add support for Windows operating system
Python 3.8 Win 7 naz - 0.7.3 (last) I created simple c;lient. When it connects to smsc with wrong IP/port (or link to smsc is lost), after 30 we can see
Traceback (most recent call last):
File "E:\py38\lib\site-packages\naz\client.py", line 810, in connect
reader, writer = await asyncio.open_connection(self.smsc_host, self.smsc_port)
File "C:\Users\S1\AppData\Local\Programs\Python\Python38\lib\asyncio\streams.py", line 52, in open_connection
transport, _ = await loop.create_connection(
File "C:\Users\S1\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 1017, in create_connection
raise exceptions[0]
File "C:\Users\S1\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 1002, in create_connection
sock = await self._connect_sock(
File "C:\Users\S1\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 916, in _connect_sock
await self.sock_connect(sock, address)
File "C:\Users\S1\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py", line 702, in sock_connect
return await self._proactor.connect(sock, address)
File "C:\Users\S1\AppData\Local\Programs\Python\Python38\lib\asyncio\windows_events.py", line 808, in _poll
value = callback(transferred, key, ov)
File "C:\Users\S1\AppData\Local\Programs\Python\Python38\lib\asyncio\windows_events.py", line 595, in finish_connect
ov.getresult()
OSError: [WinError 121]The semaphore timeout period has expired
{'timestamp': '2019-11-25 20:26:56,332', 'event': 'naz.Client.re_establish_conn_bind', 'stage': 'end', 'smpp_command': '', 'log_id': '', 'smsc_host': '192.168.143.11', 'system_id': '16500', 'client_id': '6ULXO718UHTS64NC6', 'pid': 8120}
{'timestamp': '2019-11-25 20:26:56,332', 'event': 'naz.Client.receive_data', 'stage': 'start', 'smsc_host': '192.168.143.11', 'system_id': '16500', 'client_id': '6ULXO718UHTS64NC6', 'pid': 8120}
{'timestamp': '2019-11-25 20:26:56,332', 'event': 'naz.Client.receive_data', 'stage': 'end', 'state': 'naz is yet to bind to SMSC. sleeping for 30.00 seconds', 'smsc_host': '192.168.143.11', 'system_id': '16500', 'client_id': '6ULXO718UHTS64NC6', 'pid': 8120}
{'timestamp': '2019-11-25 20:27:17,317', 'event': 'naz.Client.dequeue_messages', 'stage': 'start', 'current_session_state': 'CLOSED', 'state': 'awaiting naz to change session state to BOUND_TRX. sleeping for 30.00 seconds', 'smsc_host': '192.168.143.11', 'system_id': '16500', 'client_id': '6ULXO718UHTS64NC6', 'pid': 8120}
{'timestamp': '2019-11-25 20:27:26,334', 'event': 'naz.Client.re_establish_conn_bind', 'stage': 'start', 'smpp_command': '', 'log_id': '', 'connection_lost': True, 'smsc_host': '192.168.143.11', 'system_id': '16500', 'client_id': '6ULXO718UHTS64NC6', 'pid': 8120}
{'timestamp': '2019-11-25 20:27:26,334', 'event': 'naz.Client.connect', 'stage': 'start', 'log_id': '3krclixz65nx84bkl', 'smsc_host': '192.168.143.11', 'system_id': '16500', 'client_id': '6ULXO718UHTS64NC6', 'pid': 8120}
{'timestamp': '2019-11-25 20:27:47,319', 'event': 'naz.Client.dequeue_messages', 'stage': 'start', 'current_session_state': 'CLOSED', 'state': 'awaiting naz to change session state to BOUND_TRX. sleeping for 30.00 seconds', 'smsc_host': '192.168.143.11', 'system_id': '16500', 'client_id': '6ULXO718UHTS64NC6', 'pid': 8120}
{'timestamp': '2019-11-25 20:27:47,338', 'event': 'naz.Client.connect', 'stage': 'end', 'log_id': '3krclixz65nx84bkl', 'error': '[WinError 121] The semaphore timeout period has expired', 'smsc_host': '192.168.143.11', 'system_id': '16500', 'client_id': '6ULXO718UHTS64NC6', 'pid': 8120}
But, when link to smsc is up, client is connect to it succecfully. How to fix bug with exception?
naz has not been tested on windows, we only run the test suite on linux; https://github.com/komuw/naz/blob/944c3a3ab13e87f0539cd1950eafc6a1e2dbc378/.github/workflows/ci.yml#L68
you are going to have better luck if you try out naz on linux
ok. I will test it under ubuntu 18.04 and python 3.8.0