You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The socket module is still incomplete. Many methods and types are missing. To add methods to this module, edit the file vm/src/stdlib/socket.rs accordingly.
Hi, I would like to contribute to extending the socket module. Are there any remaining methods which are not assigned to anybody? Should I open another issue and specify which method I want, preventing others from doing the same thing? Or which method is the first priority?
@posutsai you could add a series of checkboxes in this issue, and mention what you implement. There is not a fixed list, but there is a helper script to determine the missing methods, called whats_left.sh
I think it is good to mention here what you will start on.
Hi, I would like to contribute to extending the socket module. Are there any remaining methods which are not assigned to anybody? Should I open another issue and specify which method I want, preventing others from doing the same thing? Or which method is the first priority?
I would recommend trying to implement the methods needed by socketserver as it is something that would be great to add. From a quick look we should add:
@palaviv
I start with setsockopt function. However, I meet issues at the beginning and I can't find a great existing solution on google. I would like to hear your comment or any suggestion.
According to the document on the official Python website, setsockopt takes three or four arguments. However, as I know, Rust doesn't provide function overloading. It is possible to do it with trait if it takes three arguments in each implementation.
I have referred to the implementation of sendto and there is also an optional argument flag on the document. Seems like current implementation simply ignores the optional argument.
Could you give me some hint to implement the function? Sorry for asking such an elementary question, since I just start to learn rust and try to understand it deeper by solving a real problem.
Your best option at this point would be to use OptionalArg in some way like this:
fnsetsockopt(level:PyIntRef,optname:PyObjectRef,value:OptionalArg<PyObjectRef>,optlen:OptionalArg<PyObjectRef>,vm:&VirtualMachine){// handle value and optlen combinations here:if value.is(vm.get_none()){ifletPresent = oplen {}else{returnErr(vm.new_type_error("optlen must be supplied when value is None"));}}else{ifletPresent = oplen {returnErr(vm.new_type_error("optlen must not be supplied when value is not None"));}}}
We did not yet build function polymorphism macros into rustpython, and rust does not support it, so this is currently the way to go forwards.
Activity
posutsai commentedon Aug 12, 2019
Hi, I would like to contribute to extending the socket module. Are there any remaining methods which are not assigned to anybody? Should I open another issue and specify which method I want, preventing others from doing the same thing? Or which method is the first priority?
windelbouwman commentedon Aug 12, 2019
@posutsai you could add a series of checkboxes in this issue, and mention what you implement. There is not a fixed list, but there is a helper script to determine the missing methods, called
whats_left.shI think it is good to mention here what you will start on.
palaviv commentedon Aug 13, 2019
I would recommend trying to implement the methods needed by
socketserveras it is something that would be great to add. From a quick look we should add:posutsai commentedon Aug 22, 2019
@palaviv
I start with
setsockoptfunction. However, I meet issues at the beginning and I can't find a great existing solution on google. I would like to hear your comment or any suggestion.According to the document on the official Python website,
setsockopttakes three or four arguments. However, as I know, Rust doesn't provide function overloading. It is possible to do it with trait if it takes three arguments in each implementation.I have referred to the implementation of
sendtoand there is also an optional argumentflagon the document. Seems like current implementation simply ignores the optional argument.Could you give me some hint to implement the function? Sorry for asking such an elementary question, since I just start to learn rust and try to understand it deeper by solving a real problem.
windelbouwman commentedon Aug 23, 2019
Hi @posutsai ,
Your best option at this point would be to use
OptionalArgin some way like this:We did not yet build function polymorphism macros into rustpython, and rust does not support it, so this is currently the way to go forwards.
rodrigocam commentedon Oct 22, 2020
Hello, may I implement
sendfilemethod?coolreader18 commentedon Oct 22, 2020
@rodrigocam Yeah, feel free to take a shot at it!
rodrigocam commentedon Oct 22, 2020
What do you think of this implementation? I'm using the algorithm
os::readuses to fill the byte buffer that we are going to send.coolreader18 commentedon Oct 24, 2020
@rodrigocam looks pretty good! Do you wanna make a PR for that?
rodrigocam commentedon Oct 26, 2020
@coolreader18 done! #2311
hk1997 commentedon Sep 9, 2021
Hi, I would like to contribute to this.
Is it still open?
Are there some methods which need to be implemented?
DimitrisJim commentedon Sep 9, 2021
From a quick comparison I see
gethostbyname_exmissing and a good number of the constants that are exported.nbykovsky commentedon Sep 29, 2021
Hi there, I want to start contributing with something. Are here any methods which needs to be implemented?
DimitrisJim commentedon Sep 29, 2021
my previous comment still stands, (also, try running
whats_leftand seeing what it reports for socket).varun-krishnan commentedon Oct 10, 2021
if no one has taken gethostbyname_ex, can I take a crack at it?
youknowone commentedon Jun 1, 2022
yes, exactly
youknowone commentedon Jun 1, 2022
it seems most of features are done but many properties left