Problem with TV Server and WLAN (1 Viewer)

Shazell

Portal Member
June 5, 2007
31
3
Home Country
United Kingdom United Kingdom
TV-Server Version: RC1 and SVN 19311
MediaPortal Version: RC1 and SVN 19311
MediaPortal Skin: blue 2
Windows Version: XP SP3
CPU Type: Athlon 2400+
HDD: 120 Gig
Memory: 1Gb
Motherboard: ASUS Nforce 2
Video Card: ATI Radeon 9800
Video Card Driver:
Sound Card:
Sound Card AC3:
Sound Card Driver:
1. TV Card: WinTV Nova-S-2 HD
1. TV Card Type: DVB-S2
1. TV Card Driver: latest
2. TV Card: WinTV Nova T-500
2. TV Card Type: DVB-T
2. TV Card Driver: latest

Hi,

Ok I am not attaching logs as it does not help with this problem really.

First I'll describe my setup

I have a desktop PC which is where the telephone comes into the flat and is connected to the wireless DSL router using an Ethernet cable.

I also have a HTPC in the living room which is where the satellite cable enters the flat. This is the PC that the TV Server runs on and also mediaportal for the TV in the living room.

The two PC's are at oppostite ends of the flat and especially with it being a rented flat I do not fancy hard wiring the Ethernet to the HTPC, especially as the wireless connection works fine for all other uses.


The problem comes with how the TV server initialises itself. When the TV server starts it checks to see if there is a network connection, and if there is it gives itself the IP address of that connection ie 192.168.1.2. If there is no connection it sets itself to the local host IP 127.0.0.1

When the HTPC in my living room starts up the TV Service is always started before the WLAN is connected, so it always ends up have 127.0.0.1. Now if I try to use the Desktop PC over the wireless LAN I can connect to the SQL server and see all the EPG, but when I try to watch a channel the RTSP sent to the desktop PC contains the IP 127.0.0.1 and of course it does not connect.

To solve this I can restart the TV service after the WLAN is connected and then viewing from the desktop over wireless works fine. Except that when watching TV on the living room PC after the TV Service restart and the WLAN drops out for any reason then connection to the TV SERVER is lost.

Anyone got any solutions to this other than a wired connection as I am sure I am not the only person who would rather use a wireless connection.
 

charli181

Retired Team Member
  • Premium Supporter
  • August 3, 2007
    800
    111
    Sydney
    Home Country
    Australia Australia
    Is the TV Server IP configured as a static address or a DHCP? Maybe changing to static will help in network address resolution...
     

    iamfrank

    Portal Member
    November 28, 2006
    38
    0
    42
    Perth, Western Australia
    Home Country
    What are the odds? I have a similar setup. Mine is more laziness. I have a single seat setup on my HTPC in my living room and my desktop connected to my DSL router at the other end of my house. Occasionally when I go to use the TV server, the wireless connection has dropped out. If I kill Mediaportal and fire it back up again, it works fine. Very odd. I might try your idea of static IP's.
     

    Shazell

    Portal Member
    June 5, 2007
    31
    3
    Home Country
    United Kingdom United Kingdom
    Is the TV Server IP configured as a static address or a DHCP? Maybe changing to static will help in network address resolution...

    I have tried with both DHCP and Static (Currently static)

    It makes no difference as the WLAN is not connected before the TVService is started, so the TVService assumes no network and defaults to local host 127.0.0.1
     

    SciDoctor

    Retired Team Member
  • Premium Supporter
  • February 2, 2005
    1,465
    139
    England
    Have you tried changing the tvservice startup from 'automatic' to 'automatic delayed start' .

    This is available in VISTA it also may be available in XP .
     

    Shazell

    Portal Member
    June 5, 2007
    31
    3
    Home Country
    United Kingdom United Kingdom
    Have you tried changing the tvservice startup from 'automatic' to 'automatic delayed start' .

    This is available in VISTA it also may be available in XP .

    I'll have a look when I get home tonight

    I also found an older thread with the same problem and they tried using a batch file to restart the service. But I am not sure this will help during WLAN drop outs, but could help at startup.

    https://forum.team-mediaportal.com/...client-v1-2-5-20-12-2007-ii-22027/index2.html

    Code:
    RestartTVServer.bat
    
    @echo off
    Rem Set checkip to whatever ip-address you need to have
    set checkip=192.168.230.233
    Rem Set the number of times you want to try 5 pings to the ip-address
    set maxcount=2
    
    Rem Stop de TVservice since it is bound to 127.0.0.1 only
    net stop tvservice
    
    
    FOR /L %%a IN (1,1,%maxcount%) DO (
    
    echo Run number %%a
    
    ping %checkip% > %temp%\checkip.txt
    
    FOR /F %%a IN (%temp%\checkip.txt) DO (
    if %%a==Reply (
    echo yesss, we have an ip-stack on %checkip%
    net start tvservice
    goto einde
    )
    )
    )
    
    
    :einde

    The other thing I am wondering is if it is possible to run TV Server and the normal TV Engine in parallel. This could allow me to let the wife watch the TV normally without using TV Server in the living room. And I have a second card that is used by the TV Server and I can use for streaming. (This is not a problem for me as I am English and the wife is German, she can use the DVB-T card for German TV while I use the DVB-S card for English TV.
     

    Juppe

    Portal Pro
    November 17, 2006
    315
    45
    Home Country
    Sweden Sweden
    Why not only use the TV-server and connect both card to that and have one client in the living room on the same pc as the server and one client on the other pc?
     

    Shazell

    Portal Member
    June 5, 2007
    31
    3
    Home Country
    United Kingdom United Kingdom
    Why not only use the TV-server and connect both card to that and have one client in the living room on the same pc as the server and one client on the other pc?

    Thats what I have currently and it does not work properly due to the WLAN problem. Even if I manually restart the TVservice after the WLAN is working then any drop on the WLAN causes the client on the same PC as the server to stop working.

    My main concern is an angry wife if I do not keep things working well for her :mad:
     

    charli181

    Retired Team Member
  • Premium Supporter
  • August 3, 2007
    800
    111
    Sydney
    Home Country
    Australia Australia
    Instead of a batch file, you could put a dependancy on the Service to only start after another service has started. Check out the MS KB How to delay loading of specific services

    most wireless cards don't have a service so check at the end of the article (last NOTE before references) and it suggests the spooler service or messenger as a dependancy as it is one of the last services to be loaded. becarful though as you are mucking around with the registry.
     

    Shazell

    Portal Member
    June 5, 2007
    31
    3
    Home Country
    United Kingdom United Kingdom
    Ok I've done a bit of browsing through the code

    This is the code that finds the list of IP Addresses

    /trunk/TvEngine3/TVLibrary/TVLibrary/Streaming/RtspStreaming.cs

    Code:
       67     #region ctor
       68     /// <summary>
       69     /// Initializes a new instance of the <see cref="RtspStreaming"/> class.
       70     /// </summary>
       71     /// <param name="hostName">ipadress to use for streaming.</param>
       72     public RtspStreaming(string hostName)
       73     {
       74       try
       75       {
       76         IPHostEntry local = Dns.GetHostByName(hostName);
       77         foreach (IPAddress ipaddress in [B]local.AddressList[/B])
       78         {
       79           StreamSetup(ipaddress.ToString());
       80           break;
       81         }
       82         _initialized = true;
       83         _streams = new Dictionary<string, RtspStream>();
       84       }
       85       catch (Exception ex)
       86       {
       87         Log.Log.Write(ex);
       88       }
       89     }
       90     #endregion

    So I assume that before the WLAN is up and running local.AddressList only returns the local host IP, but when the WLAN is up it only returns the IP of the WLAN (And any other active network cards, but no others in my case)

    This IP is then used here

    /trunk/TvEngine3/TVLibrary/TvService/TVController.cs

    Code:
       87 void StreamSetup(char* ipAdress)
       88 {
       89   TCHAR folder[MAX_PATH];
       90   TCHAR fileName[MAX_PATH];
       91   ::SHGetSpecialFolderPath(NULL,folder,CSIDL_COMMON_APPDATA,FALSE);
       92   sprintf(fileName,"%s\\Team MediaPortal\\MediaPortal TV Server\\log\\streaming server.Log",folder);
       93   ::DeleteFile(fileName);
       94 
       95   Log("-------------- v1.0.0.1---------------");
       96 	Log("Stream server:Setup stream server for ip:%s",ipAdress);
       97 
       98 	ReceivingInterfaceAddr=inet_addr(ipAdress );
       99 	SendingInterfaceAddr=inet_addr(ipAdress );
      100 
      101   TaskScheduler* scheduler = BasicTaskScheduler::createNew();
      102   m_env = BasicUsageEnvironment::createNew(*scheduler);
      103   m_rtspServer = RTSPServer::createNew(*m_env);
      104   if (m_rtspServer == NULL)
      105   {
      106     Log("Stream server:Failed to create RTSP server: %s",m_env->getResultMsg());
      107     exit(1);
      108   }
      109 }

    I am wondering if it would be possible to add a section in the setup to manually enter a static IP so that there would be two servers on startup, the local host and the IP specified (And any network cards found as well). I also think that for single seat cases then the local host should always be there as well to avoid any network issues. So the client on the same PC as the Server always uses the local host and works no matter what happens to the network. This would fix both my problems.

    Not sure if an invalid IP address would cause issues when the RTSP server is initialised though.

    Instead of a batch file, you could put a dependancy on the Service to only start after another service has started. Check out the MS KB How to delay loading of specific services

    most wireless cards don't have a service so check at the end of the article (last NOTE before references) and it suggests the spooler service or messenger as a dependancy as it is one of the last services to be loaded. becarful though as you are mucking around with the registry.

    I'll have a look at that as well tonight, but a secondary problem is that the WLAN router is not always available as it is only powered on when I use the desktop PC, I do not tend to leave any devices switched on when not in use as I am an eco green friendly sort of bloke (aka the wife nagging me to switch things off) :D

    Thats a problem I could solve by having the router permanently powered so not really a big issue, but I would like to see the TV server able to work either single seat or over WLAN without the WLAN status affecting the single seat client.

    And some more digging around on the web and I may have come up with a solution

    I reckon that if I edit my HOSTS file (%windir%/system32/drivers/etc/hosts)

    And change it from

    127.0.0.1 localhost

    to

    192.168.2.3 htpc

    This should set the local host to my WLAN static IP address then it may work no matter whether the WLAN is active or not as I will always have the same IP address and host name.

    Anyone know if this will cause any problems with anything else?
     

    Users who are viewing this thread

    Top Bottom