Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous message
steffen is currently offline  steffen
Messages: 38
Registered: May 2007
Location: Denmark
Member

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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: SSL handshake error
Next Topic: How to use Skylark on external server
Goto Forum:
  


Current Time: Mon Apr 29 13:18:39 CEST 2024

Total time taken to generate the page: 0.05903 seconds