Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BSD socket option SO_RCVTIMEO #29711

Closed
Delsian opened this issue Nov 2, 2020 · 3 comments
Closed

Add BSD socket option SO_RCVTIMEO #29711

Delsian opened this issue Nov 2, 2020 · 3 comments
Labels
area: Networking Enhancement Changes/Updates/Additions to existing features

Comments

@Delsian
Copy link
Contributor

Delsian commented Nov 2, 2020

Current implementation recvfrom() has no possibility to exit after the timeout, but Linux socket has option SO_RCVTIMEO

https://linux.die.net/man/7/socket

Usage:

struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 100000;
if (setsockopt(rcv_sock, SOL_SOCKET, SO_RCVTIMEO,&tv,sizeof(tv)) < 0) {
    perror("Error");
}
if(recvfrom(rcv_sock, ackBuffer,sizeof(ackBuffer), 0,
       (struct sockaddr *) &servAddr2, &fromSize) < 0){
    //timeout reached
    ...
}
@jukkar
Copy link
Member

jukkar commented Nov 2, 2020

I have no objections to this feature. Are you planning to implement this or do you wish that someone else would do the work?

@jukkar jukkar added Enhancement Changes/Updates/Additions to existing features area: Networking labels Nov 2, 2020
@Delsian
Copy link
Contributor Author

Delsian commented Nov 3, 2020

Actually I have no plans to implement this, but I strictly need any solution to correctly shut down the receiving socket after timeout.

@jukkar
Copy link
Member

jukkar commented Jan 20, 2021

The SO_RCVTIMEO options was just implemented by #31369 so closing this one.

@jukkar jukkar closed this as completed Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

No branches or pull requests

2 participants