This is a really ugly .NET hack, but it allows you create a Timeout for
any method or function. I would look at this Stackoverflow article for
more information:
http://stackoverflow.com/questions/299198/implement-c-sharp-generic-timeout
I choose to use the WaitFor(Of TResult) class included in the article,
and here:
https://github.com/michaelsutton/coded-ui-dubugging/blob/master/Timeout/WaitFor.cs
There are pitfalls, but I was willing to live with them:
Try
_Connection = New TIGR.MVSP.Pick()
_Connection.errorMsgBox = False
_Connection.ConnectionTimeout = 15
'If _Connection.Connect(_HostName, _HostPort, "MVSP", String.Empty) Then
If WaitFor(Of Boolean).FunctionWithTimeout(New Func(Of
Boolean)(Function()
Return _Connection.Connect(_HostName, _HostPort, "MVSP", String.Empty)
End Function), TimeSpan.FromSeconds(30).TotalMilliseconds) Then
' Successful
End If
Catch ex As TimeoutException
ApplicationLog.LogError("mvBaseDatabase::DoConnect", ex)
' Destroy the connection class
_Connection = Nothing
End try
Because the WaitFor class will push the .Connect to another thread to
process the command, it will be up to you to apply any SyncLocks and
address any other threading issues that may come up. I have not seen
the threading issues that were talked about in that StackOverflow
article by using this, but that doesn't mean it's not there.
The things I found when working with MVSP connectionTimeout is that
timeout is for the TCPIP connection to port, but once the port has been
connected too and MVSP starts sending data to do the account logon, the
timeout is no longer valid.
Side Note: Also, keep in mind that Reverse-DNS lookups can also cause a
delay when connecting.
So if the port MVSP is connecting to is in an invalid state, or not
accepting data for some reason, it will wait forever (or atleast a very
long time) and not timeout.
-Nathan
On 11/24/2016 9:23 PM, geneb wrote:
> On Thu, 24 Nov 2016, Wols Lists wrote:
>
>> On 22/11/16 20:34, Rick Weiser wrote:
>>> Hi all,
>>>
>>> Does anyone know if there is an inactivity timeout on an MVSP
>>> connection? If there is, is it configurable?
>>>
>> Microsoft Valued Software Professional? - probably about 8 hours, after
>> that you know they've fallen asleep :-)
>>
> No, it's the connectivity interface between Java & .net applications and
> D3. (and I'd like to know about any timeout values too!)
>
> g.
>
--
--------------------------------------------
Nathan Rector
International Spectrum, Inc
http://www.intl-spectrum.com
Phone:
720-259-1356
Conference Dates: April 11th-14th
http://www.intl-spectrum.com/conference/
Magazine: Jan/Feb 2016
- Business Tech: The Point (of Sale)
- OAUTH 2 Login with MultiValue BASIC . Part 3
- /bin/bash-ing MultiValue
- Building a Modern Line-Of-Business Application — Part 1
http://www.intl-spectrum.com/Magazine/