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

Timeout argument causes problems in sf::TcpSocket::connect() #1346

Closed
Unarelith opened this issue Jan 24, 2018 · 4 comments
Closed

Timeout argument causes problems in sf::TcpSocket::connect() #1346

Unarelith opened this issue Jan 24, 2018 · 4 comments
Assignees
Projects
Milestone

Comments

@Unarelith
Copy link
Contributor

I tried using sf::TcpSocket recently, and I decided to use the timeout argument.
When I set it to, let's say sf::seconds(5), and if it fails to connect once, the instance of the socket will no longer try to connect, and always fail.

So is this behavior intended or did you just forget to reset timeout state after a connection failed?

Library: SFML 2.4.2-4
OS: ArchLinux x86_64

@eXpl0it3r
Copy link
Member

Not the same, but similarly trying to reuse a socket, it seems there's an oversight in actually closing the closing the socket before trying to establish a new one.

Since the original poster of the thread didn't end up creating an issue, I'll just take this one then. For further posting, keep in mind though that we prefer to first discuss issues on the forum, as it often turns out to be misconfigurations or general user errors and we like to keep the issue track for confirmed problems.

@eXpl0it3r eXpl0it3r added this to the 2.5 milestone Jan 24, 2018
@eXpl0it3r eXpl0it3r added this to Discussion in SFML 2.5.0 Jan 24, 2018
@eXpl0it3r
Copy link
Member

@LaurentGomila Do you think, simply adding close() within in the connect() function is enough or are the some implications to keep in mind?

@LaurentGomila
Copy link
Member

LaurentGomila commented Jan 25, 2018

"Reusing sockets" is something that should be carefully reviewed in the whole network module, I see that similar functions (TcpListener::listen, UdpSocket::bind, ...) have similar behaviour, ie. they don't do anything specific if the socket already exists, while they probably should.

@eXpl0it3r eXpl0it3r removed this from the 2.5 milestone Jan 25, 2018
@eXpl0it3r eXpl0it3r removed this from Discussion in SFML 2.5.0 Jan 25, 2018
binary1248 added a commit that referenced this issue Apr 8, 2018
…ng listen or connect while the underlying socket object already exists, also adjusted UdpSocket to be consistent with connect and listen behaviour when calling bind while the underlying socket object already exists. Fixes #1346
@binary1248
Copy link
Member

@Quent42340 Try out PR #1408.

@binary1248 binary1248 self-assigned this Apr 8, 2018
@eXpl0it3r eXpl0it3r added this to Discussion in SFML 2.5.0 via automation Apr 8, 2018
@eXpl0it3r eXpl0it3r added this to the 2.5 milestone Apr 8, 2018
@eXpl0it3r eXpl0it3r moved this from Discussion to Ready in SFML 2.5.0 Apr 8, 2018
eXpl0it3r pushed a commit that referenced this issue Apr 14, 2018
…ng listen or connect while the underlying socket object already exists, also adjusted UdpSocket to be consistent with connect and listen behaviour when calling bind while the underlying socket object already exists. Fixes #1346
SFML 2.5.0 automation moved this from Ready to Merged / Superseded Apr 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
SFML 2.5.0
  
Merged / Superseded
Development

No branches or pull requests

4 participants