Media Companion

Discussion and development board for the program Media Companion.
 
HomeHome  FAQFAQ  SearchSearch  RegisterRegister  Log inLog in  

Share | 
 

 Help wanted with an old issue

View previous topic View next topic Go down 
AuthorMessage
StormyKnight
VIP
VIP


Posts : 556
Join date : 2008-10-08
Location : Australia

PostSubject: Re: Help wanted with an old issue   Mon Oct 12, 2009 2:27 pm

Billy, whilst I don't think the cause of the timeout failure is the same as is mentioned in this code below, but latter the poster claims the timeout is now working, so perhaps the corrected code may assist.

http://www.dotnet247.com/247reference/msgs/21/106984.aspx

It looks like he is using a different syntax to create the wr object too.

Cheers
Back to top Go down
View user profile
billyad2000
Admin
avatar

Posts : 1326
Join date : 2008-09-20

PostSubject: Re: Help wanted with an old issue   Sat Oct 10, 2009 12:25 pm

wodi666 wrote:
You can try to use a ServicePoint Connection, there you can use ServicePoint.MaxIdleTime / ServicePoint.ConnectionLeaseTimeout

Thanks, I'll try that.

_________________
Do you have a problem with Media Companion, before posting a bug then please check you have the very latest version of Media Companion http://billyad2000.darkbb.com/announcements-f1/
Back to top Go down
View user profile http://billyad2000.co.uk
wodi666
Junior Member
Junior Member


Posts : 17
Join date : 2008-10-15

PostSubject: Re: Help wanted with an old issue   Fri Oct 09, 2009 10:12 pm

You can try to use a ServicePoint Connection, there you can use ServicePoint.MaxIdleTime / ServicePoint.ConnectionLeaseTimeout

Code:

Dim instance As ServicePoint
Dim value As Integer

value = instance.MaxIdleTime

instance.MaxIdleTime = value


Code:

Imports System
Imports System.Net
Imports System.Net.Sockets
Imports System.IO
Imports System.Threading
Public Class ServicePointExample

    ' Pass in the name of the Web page to retrieve.
    Public Shared Sub Main(ByVal args() As String)
        Dim page As String
        If args Is Nothing OrElse args.Length = 0 OrElse args(0).Length = 0 Then
            page = "http://www.contoso.com/default.html"
        Else
            page = args(0)
        End If

        Dim request As HttpWebRequest = CType(WebRequest.Create(page), HttpWebRequest)
        ' Get the service point that handles the request's socket connection.
        Dim point As ServicePoint = request.ServicePoint
        ' Set the receive buffer size on the underlying socket.
        point.ReceiveBufferSize = 2048
        ' Set the connection lease timeout to infinite.
        point.ConnectionLeaseTimeout = Timeout.Infinite
        ' Send the request.
        Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
        Dim responseStream As Stream = response.GetResponseStream()
        Dim s As New StreamReader(responseStream)
        ' Display the response.
        Console.WriteLine(s.ReadToEnd())
        responseStream.Close()
        response.Close()
    End Sub 'Main
End Class
Back to top Go down
View user profile
billyad2000
Admin
avatar

Posts : 1326
Join date : 2008-09-20

PostSubject: Help wanted with an old issue   Fri Oct 09, 2009 8:21 pm

This is regards to an issue that is as old as MC and relates to what happens when a website such as TMDB or TVDB is down.

Here is an example of the code that is used;
Code:
            Dim wrGETURL As WebRequest
            wrGETURL = WebRequest.Create(url)
            Dim thisProxy As New WebProxy("thisproxy", 80)
            thisProxy.BypassProxyOnLocal = True
            Dim objStream As Stream
            objStream = wrGETURL.GetResponse.GetResponseStream()
            Dim objReader As New StreamReader(objStream)

            page = objReader.ReadToEnd

This works OK most of the time, the problem is when the "url" is not available for some reason. MC stands still until it times out which is way too long, I tried adding the following to the code;
Code:
            wrGETURL.Timeout = 5000
The idea being that the webrequest would timeout after 5 seconds, but it has no effect whatsoever
I could create a separate thread for each of these, but it would take a lot of time and code and is in my opinion, a very complicated solution for a simple problem.

Any help would be appreciated.

_________________
Do you have a problem with Media Companion, before posting a bug then please check you have the very latest version of Media Companion http://billyad2000.darkbb.com/announcements-f1/
Back to top Go down
View user profile http://billyad2000.co.uk
Sponsored content




PostSubject: Re: Help wanted with an old issue   

Back to top Go down
 
Help wanted with an old issue
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Issue - Selenium checks object in some cache
» Got My Copy of Nintendo Power's Final Issue!
» Pop-up issue with Selenium RC in IE7 testing
» Tutorial for how to use storeEval command to get property of an element.
» Page load issue

Permissions in this forum:You cannot reply to topics in this forum
Media Companion :: Media Companion :: Program Development-
Jump to: