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 » Cant connect but dont get an error
Re: Cant connect but dont get an error [message #39560 is a reply to message #39500] Sat, 30 March 2013 09:47 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14257
Registered: November 2005
Ultimate Member
This is a bit more tricky than it seems - socket API (I mean, Linux/Win32, not U++ encapsulation) is highly optimized and queued, for example Connect just starts connection to the port, without actually finishing it - and OS might detect that to connection is not available a couple of operations later.

Anyway, I have tried and this seems to work:

	TcpSocket socket;
	for(int i = 1; i < 120; i++)
		LOG(i << ' ' << (socket.Timeout(2000).Connect(url, i) && socket.Wait(WAIT_WRITE) && socket.Put("\n") == 1));


Please note that scanning ports is generally considered as form of attack...

Mirek
 
Read Message
Read Message
Read Message
Previous Topic: How to call a C++ function in Witz template?
Next Topic: Witz internationalization
Goto Forum:
  


Current Time: Sat May 10 07:34:49 CEST 2025

Total time taken to generate the page: 0.00308 seconds