Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
We are having difficulties using the System.Net.Sockets.TcpClient class.
We are trying to test if a ip address and port is reachable.
This is a feature from our Windows version.
If we call the Connect method on a valid IpAddress but with an unreachable port it takes a long time (around 1 min) before we get a result.
In the Windows version the same process takes only a few seconds.
To work around the issue we tried adding a time out feature by using the BeginConnect and EndConnect method.
A process that works on the Windows version but in the Mac version I get an ObjectDisposedException.
I have a sample application for you https://www.dropbox.com/s/9g9n7otnou9touw/TestTCPClient.zip?dl=0
Could you take a look at this bug?
Hi Chris, Rodrigo
.NET implementation has indeed a shorter timeout of 20 seconds and Mono a longer one of 85 seconds.
@Chris The method ExecutePortScan(string host, int port, int timeout) has some issues, the exception also occurs on .NET. This happens because tcpClient.EndConnect(result) should never be called after tcpClient.Close (). Please check this fix: https://gist.github.com/esdrubal/4316507e12fefdb7bc63
@Rodrigo Should we change our timeout to 20 seconds as .NET or mark this as a feature?
This sounds to me like a platform specific feature, and we probably should not change that.
In this new era of .NET code, being closer to the underlying platform is a bonus.
This is a clear case of the customer having to alter their code to run on Unix.
@Miguel I agree.
This timeout can be changed by doing:
sudo sysctl -w net.inet.tcp.keepinit=20000
Marking this as a feature.