payload: {"action":"created","issue":{"url":"https://api.github.com/repos/micropython/micropython/issues/4475","repository_url":"https://api.github.com/repos/micropython/micropython","labels_url":"https://api.github.com/repos/micropython/micropython/issues/4475/labels{/name}","comments_url":"https://api.github.com/repos/micropython/micropython/issues/4475/comments","events_url":"https://api.github.com/repos/micropython/micropython/issues/4475/events","html_url":"https://github.com/micropython/micropython/issues/4475","id":407921392,"node_id":"MDU6SXNzdWU0MDc5MjEzOTI=","number":4475,"title":"RFC: Create a common usocket_mphal","user":{"login":"Jongy","id":8831572,"node_id":"MDQ6VXNlcjg4MzE1NzI=","avatar_url":"https://avatars2.githubusercontent.com/u/8831572?v=4","gravatar_id":"","url":"https://api.github.com/users/Jongy","html_url":"https://github.com/Jongy","followers_url":"https://api.github.com/users/Jongy/followers","following_url":"https://api.github.com/users/Jongy/following{/other_user}","gists_url":"https://api.github.com/users/Jongy/gists{/gist_id}","starred_url":"https://api.github.com/users/Jongy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jongy/subscriptions","organizations_url":"https://api.github.com/users/Jongy/orgs","repos_url":"https://api.github.com/users/Jongy/repos","events_url":"https://api.github.com/users/Jongy/events{/privacy}","received_events_url":"https://api.github.com/users/Jongy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-02-07T22:13:33Z","updated_at":"2019-02-08T06:22:44Z","closed_at":"2019-02-08T06:22:44Z","author_association":"CONTRIBUTOR","body":"We currently have 4 different `modusocket` implementations, all supposed to expose the exact same interface.\r\n\r\nI believe lots of the code can be shared. There's lot of parameters handling and conversion between `mp_obj_t` to simple data types, and vice versa. Most of the systems do expose a BSD sockets API, or, at least, their API can be easily wrapped to achieve the BSD sockets API.\r\n\r\nHaving multiple implementations of the pythonic API is bad because things go wrong and little inconsistencies show up between different ports. Generally I think the pythonic API should be implemented only once, so having a file like `utime_mphal.c` is a nicer way.\r\n\r\nAlso, when the python API impl is done, it's easier to now implement it for more ports.\r\n\r\nWould `modusocket_mphal.c` do it?"},"comment":{"url":"https://api.github.com/repos/micropython/micropython/issues/comments/461703725","html_url":"https://github.com/micropython/micropython/issues/4475#issuecomment-461703725","issue_url":"https://api.github.com/repos/micropython/micropython/issues/4475","id":461703725,"node_id":"MDEyOklzc3VlQ29tbWVudDQ2MTcwMzcyNQ==","user":{"login":"dpgeorge","id":6187689,"node_id":"MDQ6VXNlcjYxODc2ODk=","avatar_url":"https://avatars1.githubusercontent.com/u/6187689?v=4","gravatar_id":"","url":"https://api.github.com/users/dpgeorge","html_url":"https://github.com/dpgeorge","followers_url":"https://api.github.com/users/dpgeorge/followers","following_url":"https://api.github.com/users/dpgeorge/following{/other_user}","gists_url":"https://api.github.com/users/dpgeorge/gists{/gist_id}","starred_url":"https://api.github.com/users/dpgeorge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpgeorge/subscriptions","organizations_url":"https://api.github.com/users/dpgeorge/orgs","repos_url":"https://api.github.com/users/dpgeorge/repos","events_url":"https://api.github.com/users/dpgeorge/events{/privacy}","received_events_url":"https://api.github.com/users/dpgeorge/received_events","type":"User","site_admin":false},"created_at":"2019-02-08T06:22:44Z","updated_at":"2019-02-08T06:22:44Z","author_association":"CONTRIBUTOR","body":"The problem with unifying the `usocket` implementations in that the ports usually have different underlying implementations with subtle differences that need to be accounted for.  Currently there are 3 broad classes of `usocket` code:\r\n1. `extmod/modlwip.c` which directly wraps the low-level interface provided by lwIP, so that threads are not needed.\r\n2. Those based on BSD sockets, like in unix, esp32 and cc3200 ports.  Note that cc3200 has some differences here to standard BSD sockets.  It's possible that unix and esp32 `usocket` code could be combined.\r\n3. stm32 provides a separate general framework for plugging in external socket providers, eg cc3000 and wiznet (when the TCP/IP stack lives on the external device).  This is similar to (2) above but goes through a dispatch layer so that multiple different BSD socket-like providers can be glued together.\r\n\r\nIf some kind of unification was done (which is a good thing to consider) then it would be very important to retain the efficiency of how (1) is currently implemented."}}
other: {"actor":{"display_login":"dpgeorge"}}