{"action":"created","issue":{"url":"https://api.github.com/repos/chrysn/aiocoap/issues/27","labels_url":"https://api.github.com/repos/chrysn/aiocoap/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/chrysn/aiocoap/issues/27/comments","events_url":"https://api.github.com/repos/chrysn/aiocoap/issues/27/events","html_url":"https://github.com/chrysn/aiocoap/issues/27","id":101633327,"number":27,"title":"OSError when running the examples on Windows 10","user":{"login":"ksrm","id":3838362,"avatar_url":"https://avatars.githubusercontent.com/u/3838362?v=3","gravatar_id":"","url":"https://api.github.com/users/ksrm","html_url":"https://github.com/ksrm","followers_url":"https://api.github.com/users/ksrm/followers","following_url":"https://api.github.com/users/ksrm/following{/other_user}","gists_url":"https://api.github.com/users/ksrm/gists{/gist_id}","starred_url":"https://api.github.com/users/ksrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksrm/subscriptions","organizations_url":"https://api.github.com/users/ksrm/orgs","repos_url":"https://api.github.com/users/ksrm/repos","events_url":"https://api.github.com/users/ksrm/events{/privacy}","received_events_url":"https://api.github.com/users/ksrm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-18T11:21:19Z","updated_at":"2015-08-24T11:24:47Z","closed_at":null,"body":"    C:\\home\\aiocoap (master)\r\n    λ py -3 server.py\r\n    ERROR:asyncio:Task exception was never retrieved\r\n    future: <Task finished coro=<create_server_context() done, defined at C:\\home\\aiocoap\\aiocoap\\protocol.py:520> exception=OSError(10022, 'An invalid argument was supplied', None, 10022, None)>\r\n    Traceback (most recent call last):\r\n      File \"C:\\Python34\\lib\\asyncio\\tasks.py\", line 238, in _step\r\n        result = next(coro)\r\n      File \"C:\\home\\aiocoap\\aiocoap\\protocol.py\", line 535, in create_server_context\r\n        transport, protocol = yield from loop.create_datagram_endpoint(protofact, family=socket.AF_INET6)\r\n      File \"C:\\Python34\\lib\\asyncio\\base_events.py\", line 744, in create_datagram_endpoint\r\n        waiter)\r\n      File \"C:\\Python34\\lib\\asyncio\\selector_events.py\", line 90, in _make_datagram_transport\r\n        address, waiter, extra)\r\n      File \"C:\\Python34\\lib\\asyncio\\selector_events.py\", line 983, in __init__\r\n        super().__init__(loop, sock, protocol, extra)\r\n      File \"C:\\Python34\\lib\\asyncio\\selector_events.py\", line 513, in __init__\r\n        self._extra['sockname'] = sock.getsockname()\r\n    OSError: [WinError 10022] An invalid argument was supplied\r\n\r\nand\r\n\r\n      C:\\home\\aiocoap (master)\r\n    λ py -3 clientGET.py\r\n    Traceback (most recent call last):\r\n      File \"clientGET.py\", line 34, in <module>\r\n        asyncio.get_event_loop().run_until_complete(main())\r\n      File \"C:\\Python34\\lib\\asyncio\\base_events.py\", line 316, in run_until_complete\r\n        return future.result()\r\n      File \"C:\\Python34\\lib\\asyncio\\futures.py\", line 275, in result\r\n        raise self._exception\r\n      File \"C:\\Python34\\lib\\asyncio\\tasks.py\", line 238, in _step\r\n        result = next(coro)\r\n      File \"clientGET.py\", line 20, in main\r\n        protocol = yield from Context.create_client_context()\r\n      File \"C:\\home\\aiocoap\\aiocoap\\protocol.py\", line 510, in create_client_context\r\n        transport, protocol = yield from loop.create_datagram_endpoint(protofact, family=socket.AF_INET6)\r\n      File \"C:\\Python34\\lib\\asyncio\\base_events.py\", line 744, in create_datagram_endpoint\r\n        waiter)\r\n      File \"C:\\Python34\\lib\\asyncio\\selector_events.py\", line 90, in _make_datagram_transport\r\n        address, waiter, extra)\r\n      File \"C:\\Python34\\lib\\asyncio\\selector_events.py\", line 983, in __init__\r\n        super().__init__(loop, sock, protocol, extra)\r\n      File \"C:\\Python34\\lib\\asyncio\\selector_events.py\", line 513, in __init__\r\n        self._extra['sockname'] = sock.getsockname()\r\n    OSError: [WinError 10022] An invalid argument was supplied"},"comment":{"url":"https://api.github.com/repos/chrysn/aiocoap/issues/comments/134157863","html_url":"https://github.com/chrysn/aiocoap/issues/27#issuecomment-134157863","issue_url":"https://api.github.com/repos/chrysn/aiocoap/issues/27","id":134157863,"user":{"login":"ksrm","id":3838362,"avatar_url":"https://avatars.githubusercontent.com/u/3838362?v=3","gravatar_id":"","url":"https://api.github.com/users/ksrm","html_url":"https://github.com/ksrm","followers_url":"https://api.github.com/users/ksrm/followers","following_url":"https://api.github.com/users/ksrm/following{/other_user}","gists_url":"https://api.github.com/users/ksrm/gists{/gist_id}","starred_url":"https://api.github.com/users/ksrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksrm/subscriptions","organizations_url":"https://api.github.com/users/ksrm/orgs","repos_url":"https://api.github.com/users/ksrm/repos","events_url":"https://api.github.com/users/ksrm/events{/privacy}","received_events_url":"https://api.github.com/users/ksrm/received_events","type":"User","site_admin":false},"created_at":"2015-08-24T11:24:47Z","updated_at":"2015-08-24T11:24:47Z","body":"If I modify the `create_datagram_endpoint` call in `create_server_context` to this, and remove the `setsockopt` and `bind` calls:\r\n\r\n    transport, protocol = yield from loop.create_datagram_endpoint(protofact, local_addr=('127.0.0.1', 9999))\r\n    #transport._sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)\r\n    #transport._sock.bind(bind)\r\n\r\nAnd then modify the call in `create_client_context`:\r\n\r\n    transport, protocol = yield from loop.create_datagram_endpoint(protofact, remote_addr=('127.0.0.1', 9999))\r\n\r\nThen if I request `coap://localhost:9999/time` with clientGET.py, it is sort of working:\r\n\r\n    λ py -3 clientGET.py\r\n    Result: 2.05 Content\r\n    b'2015-08-24 12:17'\r\n    Exception ignored in:\r\n\r\nNot sure yet what the root cause is. Somebody else had the same problem here: http://stackoverflow.com/questions/31371055/trying-to-connect-to-coap-resource-with-python-library"}}