Title: Thread-safe client implementation · Issue #187 · python-smpplib/python-smpplib · GitHub
Open Graph Title: Thread-safe client implementation · Issue #187 · python-smpplib/python-smpplib
X Title: Thread-safe client implementation · Issue #187 · python-smpplib/python-smpplib
Description: Hello, I noticed that the README suggests starting a separate thread to call listen(), but I don't believe the underlying socket is thread-safe (unless I'm missing something of course). I believe I've worked out an implementation that at...
Open Graph Description: Hello, I noticed that the README suggests starting a separate thread to call listen(), but I don't believe the underlying socket is thread-safe (unless I'm missing something of course). I believe I...
X Description: Hello, I noticed that the README suggests starting a separate thread to call listen(), but I don't believe the underlying socket is thread-safe (unless I'm missing something of course). I b...
Opengraph URL: https://github.com/python-smpplib/python-smpplib/issues/187
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Thread-safe client implementation","articleBody":"Hello, I noticed that the README suggests starting a separate thread to call `listen()`, but I don't believe the underlying socket is thread-safe (unless I'm missing something of course).\r\n\r\nI believe I've worked out [an implementation](https://gist.github.com/tobiasmcnulty/af5f816fe9b801631b0b4d636fa1e6a7) that at least allows `send_message()` to avoid clobbering any enquire_link or other PDUs the socket might be exchanging at the time `send_message()` is called.\r\n\r\nWould it be worth cleaning this up and submitting a PR? If so, how would you like me to approach it? A few options I can think of:\r\n\r\n1. Include the minimal hooks necessary (if any) for someone to implement their own client outside of smpplib proper\r\n2. Update the existing client to use [the thread-safe socket implementation](https://stackoverflow.com/a/51105047/166053)\r\n3. Include an alternate `ThreadSafeClient` implementation, as in [the linked gist](https://gist.github.com/tobiasmcnulty/af5f816fe9b801631b0b4d636fa1e6a7)\r\n\r\nThanks for this library and in advance for any input you may have!","author":{"url":"https://github.com/tobiasmcnulty","@type":"Person","name":"tobiasmcnulty"},"datePublished":"2021-11-30T23:33:39.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/187/python-smpplib/issues/187"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7c087d06-c40f-9b29-ac19-eba5866fa685 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B1D2:148D1:18A766E:22D263B:696F6766 |
| html-safe-nonce | fc5239521905665f863cd5c4f14bd1ca5096bcf2854d7f462022847cc63e99c9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMUQyOjE0OEQxOjE4QTc2NkU6MjJEMjYzQjo2OTZGNjc2NiIsInZpc2l0b3JfaWQiOiIyMDgyMzAxMTUxNjE1NjA4Njc4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 96aba9201e22973e3d08b7dc5f17c4d51199344cc4eae82dccad3416dcde18c4 |
| hovercard-subject-tag | issue:1067776688 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-smpplib/python-smpplib/187/issue_layout |
| twitter:image | https://opengraph.githubassets.com/51ad45620e32c7b3f6f4cedadf5a737b8bedb32369fa04221ead02dfcb0a3968/python-smpplib/python-smpplib/issues/187 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/51ad45620e32c7b3f6f4cedadf5a737b8bedb32369fa04221ead02dfcb0a3968/python-smpplib/python-smpplib/issues/187 |
| og:image:alt | Hello, I noticed that the README suggests starting a separate thread to call listen(), but I don't believe the underlying socket is thread-safe (unless I'm missing something of course). I believe I... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tobiasmcnulty |
| hostname | github.com |
| expected-hostname | github.com |
| None | dd6be7b30d2e12704d0d9723ad4a7950f9e3ad8461efc40b5411aad62e847a89 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-smpplib/python-smpplib git https://github.com/python-smpplib/python-smpplib.git |
| octolytics-dimension-user_id | 45378833 |
| octolytics-dimension-user_login | python-smpplib |
| octolytics-dimension-repository_id | 9441405 |
| octolytics-dimension-repository_nwo | python-smpplib/python-smpplib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 9441405 |
| octolytics-dimension-repository_network_root_nwo | python-smpplib/python-smpplib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0bab932a9532ed9bc2e3e2614af9348ab39af6a7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width