Home » U++ Library support » U++ MT-multithreading and servers » [SOLVED] TcpSocket Connect error
[SOLVED] TcpSocket Connect error [message #42396] |
Tue, 11 March 2014 12:35  |
|
Hi,
Newest uppsrc revision 7033.
Here on my Ubuntu 12.04 workstation I see a problem with TcpSocket.Connect, it always returns true, even if no server is listening at the other end:
TcpSocket client_socket;
client_socket.Timeout(5000);
if (client_socket.Connect("127.0.0.1", 12345)) // Connect to non existing server
{
LOG("ERROR, Connect returned true");
}
else
{
LOG("Correct, The connection could not be established");
}
The doc mentions the operation is blocking, but it is not. It does not say anything about the return value, I just assume it would be true on success.
It works if I comment the O_NONBLOCK from Socket.cpp->TcpSocket::SetupSocket(), like this:
if(fcntl(socket, F_SETFL, (fcntl(socket, F_GETFL, 0)/* | O_NONBLOCK*/))) {
I discovered this while trying to connect to a slow server and the not so reader friendly TcpSocket::RawConnect function passed on the SOCKERR(EINPROGRESS) check. No matter if a connection was established or not.
I don't have the in depth knowledge on the upp code base, to say if removing the O_NONBLOCK will cause undesired problems in other places.
[Updated on: Wed, 02 April 2014 07:03] Report message to a moderator
|
|
|
 |
|
[SOLVED] TcpSocket Connect error
By: steffen on Tue, 11 March 2014 12:35
|
 |
|
Re: TcpSocket Connect error
By: mirek on Wed, 12 March 2014 10:52
|
 |
|
Re: TcpSocket Connect error
By: steffen on Wed, 12 March 2014 17:24
|
 |
|
Re: TcpSocket Connect error
By: mirek on Wed, 12 March 2014 19:07
|
 |
|
Re: TcpSocket Connect error
By: steffen on Thu, 13 March 2014 08:28
|
 |
|
Re: TcpSocket Connect error
By: steffen on Thu, 13 March 2014 08:43
|
 |
|
Re: TcpSocket Connect error
By: mirek on Sun, 23 March 2014 17:16
|
 |
|
Re: TcpSocket Connect error
By: steffen on Mon, 24 March 2014 08:22
|
 |
|
Re: TcpSocket Connect error
By: mirek on Mon, 24 March 2014 10:21
|
 |
|
Re: TcpSocket Connect error
By: steffen on Mon, 24 March 2014 12:02
|
 |
|
Re: TcpSocket Connect error
By: mirek on Tue, 01 April 2014 19:51
|
 |
|
Re: TcpSocket Connect error
By: steffen on Wed, 02 April 2014 07:02
|
Goto Forum:
Current Time: Tue Apr 29 18:53:54 CEST 2025
Total time taken to generate the page: 0.00725 seconds
|