SFML community forums

Help => Network => Topic started by: tauzero on June 06, 2019, 04:13:24 pm

Title: Non-blocking TCP connect cannot be completed
Post by: tauzero on June 06, 2019, 04:13:24 pm
The ability to complete a non-blocking TCP connection by the client as discussed in the forum topic:
https://en.sfml-dev.org/forums/index.php?topic=7118.0
no longer works in 2.5.x. Looking at the change to TcpSocket::connect() between 2.4.x and master at https://github.com/SFML/SFML/blob/master/src/SFML/Network/TcpSocket.cpp points to the added disconnect() at the start of connect() as the cause. I can't find a work-around (other than continue use of 2.4.x).
Title: Re: Non-blocking TCP connect cannot be completed
Post by: Laurent on June 06, 2019, 08:25:13 pm
Did you try with a minimal code to make sure it wasn't something else? Any message in the standard (error) output?
Title: Re: Non-blocking TCP connect cannot be completed
Post by: tauzero on June 06, 2019, 09:52:55 pm
No I did not.
Note that the subsequent calls to connect() were testing to see if the socket (m_socket) is in the connected state, and returning 'Done' if it is.
I traced the call chain as ... TcpSocket::connect() -> TcpSocket::disconnect() -> Socket::close() which on return insures the socket handle (m_socket) is set to priv::SocketImpl::invalidSocket().
Thus, TcpSocket::connect(), always begins the establishment of a new connection on a newly created socket (via Socket::create()).
Title: Re: Non-blocking TCP connect cannot be completed
Post by: Laurent on June 06, 2019, 10:27:37 pm
Quote
No I did not.
Please do! It might be a bug in SFML 2.5, but we'd better be sure before investigating time on it.