{"action":"opened","issue":{"url":"https://api.github.com/repos/python-ivi/python-vxi11/issues/17","repository_url":"https://api.github.com/repos/python-ivi/python-vxi11","labels_url":"https://api.github.com/repos/python-ivi/python-vxi11/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/python-ivi/python-vxi11/issues/17/comments","events_url":"https://api.github.com/repos/python-ivi/python-vxi11/issues/17/events","html_url":"https://github.com/python-ivi/python-vxi11/issues/17","id":186379740,"number":17,"title":"Hang due to bug in sendfrag","user":{"login":"bobmcnamara","id":7468667,"avatar_url":"https://avatars.githubusercontent.com/u/7468667?v=3","gravatar_id":"","url":"https://api.github.com/users/bobmcnamara","html_url":"https://github.com/bobmcnamara","followers_url":"https://api.github.com/users/bobmcnamara/followers","following_url":"https://api.github.com/users/bobmcnamara/following{/other_user}","gists_url":"https://api.github.com/users/bobmcnamara/gists{/gist_id}","starred_url":"https://api.github.com/users/bobmcnamara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobmcnamara/subscriptions","organizations_url":"https://api.github.com/users/bobmcnamara/orgs","repos_url":"https://api.github.com/users/bobmcnamara/repos","events_url":"https://api.github.com/users/bobmcnamara/events{/privacy}","received_events_url":"https://api.github.com/users/bobmcnamara/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-31T19:49:35Z","updated_at":"2016-10-31T19:49:35Z","closed_at":null,"body":"On Mac OS X, sending data larger than ~128K to a Keysight scope results in a timeout in recvfrag.  This is caused by a bug in sendfrag where the code does not check the return value from sock.send.  Here is the modified code for sendfrag which corrects this:\r\n\r\n```python\r\ndef sendfrag(sock, last, frag):\r\n    x = len(frag)\r\n    if last: x = x | 0x80000000\r\n    header = struct.pack(\">I\", x)\r\n    msg = header + frag\r\n    msg_len = len(msg)\r\n    totalsent = 0\r\n    while totalsent < msg_len:\r\n        sent = sock.send(msg[totalsent:])\r\n        if sent == 0:\r\n            raise RuntimeError(\"socket connection broken\")\r\n        totalsent = totalsent + sent\r\n```\r\n\r\n"}}
{"actor":{"display_login":"bobmcnamara"}}