Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Registered User
    Join Date
    Oct 2013
    Posts
    22

    StreamSocketListener not working on Lumia, but Ok on Samsung Ativ

    Hi,

    there is a problem with connections to localhost. When the phone is not connected to wifi or gsm-data, calls to localhost: are ignored by StreamSocketListener.

    Its an old issue, which we believed was solved, because it didn't occur any more on Samsung Ativ S after installing the GDR3-update.

    Now we realized, that Nokia Lumia phones still have this behaviour, even with OS 8.0.10521.

    Here is the issue more in detail:
    http://developer.nokia.com/community..._Windows_Phone

    Is there anything we can do? Our app is using StreamSocketListener listening to localhost and its not working on Lumia-phones, if not connected to wifi or gsm-data.
    On Samsungs Ativ S everything still works fine.

    Thanks and best regards
    Tom

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,807

    Re: StreamSocketListener not working on Lumia, but Ok on Samsung Ativ

    Do you need this question here in the Maps API board?

  3. #3
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    529

    Re: StreamSocketListener not working on Lumia, but Ok on Samsung Ativ

    The reason why it's here is because they use a local HTTP server in order to provide a local tile source for the Map Control. It still might be better off in the general section given that the problem they are facing is not directly connected to the mapping control. Lets hope the control gets improved in 8.1 to directly support local tile sources.

  4. #4
    Registered User
    Join Date
    Oct 2013
    Posts
    22

    Re: StreamSocketListener not working on Lumia, but Ok on Samsung Ativ

    Quote Originally Posted by wizard_hu_ View Post
    Do you need this question here in the Maps API board?
    Sorry, I didn't realize that I was in the Map-Api forum.
    Can we move this thread? Its still important to us and we are hoping for a solution.
    Tom

  5. #5
    Registered User
    Join Date
    Oct 2013
    Posts
    22

    Re: StreamSocketListener not working on Lumia, but Ok on Samsung Ativ

    Quote Originally Posted by SB Dev View Post
    Lets hope the control gets improved in 8.1 to directly support local tile sources.
    This would be great.

    But this workaround with a local HTTP server is really working nice so far.
    We are also doing a Windows-Desktop GPS-Mapping Software and we can export all kind of maps to our WP8-Map for offline use.

    Unfortunately only on Samsungs Ativ S, on Lumia we have this issue.
    I hope that you guys at Nokia are interested in fixing that

    Tom

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,807

    Re: StreamSocketListener not working on Lumia, but Ok on Samsung Ativ

    Quote Originally Posted by Tom_nam View Post
    Sorry, I didn't realize that I was in the Map-Api forum.
    Ok, just I saw your use case was really about map-related things, and I was not sure about moving.
    Can we move this thread? Its still important to us and we are hoping for a solution.
    Yes, it is in the general WP board now. Also, a redirection link is left in the Maps board.

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,807

    Re: StreamSocketListener not working on Lumia, but Ok on Samsung Ativ

    Quote Originally Posted by Tom_nam View Post
    I hope that you guys at Nokia are interested in fixing that
    Bad news: Champs and Mods here are 3rd party enthusiasts/volunteers.
    Even worse: Nokia assumes WP as a flat platform, and there is no separate bug reporting for Nokia WP devices (and in fact I have no idea about bug reporting on MSDN either). I try to lure a real Nokian here.

  8. #8
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: StreamSocketListener not working on Lumia, but Ok on Samsung Ativ

    Hmm, that issue ...

    To clarify, are you seeing this if the device does not have a data connection (there is a SIM but data connection is off) or if it does not have a SIM at all (offline/flight mode) ?

    Best regards,
    Lucian
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  9. #9
    Registered User
    Join Date
    Oct 2013
    Posts
    22

    Re: StreamSocketListener not working on Lumia, but Ok on Samsung Ativ

    we didn't test without SIM-card.
    In all cases there was a sim-card in, but because of several circumstances like to far outside in the bush or flightmode or no wifi and no data-conection, the phone couldn't connect to the internet.
    Tom

  10. #10
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: StreamSocketListener not working on Lumia, but Ok on Samsung Ativ

    Ok, I'll run a couple of tests and create an internal bug report about it. Hopefully we can do something about it for the next firmware release. Unfortunately the only non-Lumia device I have is an HTC 8X so let's see if that one has the same issue or not.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  11. #11
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: StreamSocketListener not working on Lumia, but Ok on Samsung Ativ

    Ok, I tested this and ... it works as expected on Nokia Lumia 1520 with Lumia Black firmware.

    Click image for larger version. 

Name:	wp_ss_20140219_0003[1].jpg 
Views:	234 
Size:	80.4 KB 
ID:	1567

    I tested with connection on, then in flight mode and finally after rebooting the device while in flight mode. In all these states the web control was able to retrieve content from the local server.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  12. #12
    Registered User
    Join Date
    Oct 2013
    Posts
    22

    Re: StreamSocketListener not working on Lumia, but Ok on Samsung Ativ

    Hi Lucian, thanks for testing, we didn't test the 1520, only 520 up tp 925 with Lumia Black.
    Will you be able to share your test-program with us?
    Maybe you are doing something different.
    Best regards,
    Tom

  13. #13
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: StreamSocketListener not working on Lumia, but Ok on Samsung Ativ

    I tried since with 920 and 1020 as well, with no problems.

    The code is simple, just add this to the MainPage.xaml.cs of an empty project:

    Code:
    using Windows.Networking.Sockets;
    using Windows.Storage.Streams;
    using System.Threading.Tasks;
    using System.IO;
    using System.Text;
    
    namespace LocalServerTest
    {
        public partial class MainPage : PhoneApplicationPage
        {
            StreamSocketListener server;
            // Constructor
            public MainPage()
            {
                InitializeComponent();
                Loaded += MainPage_Loaded;
                // Sample code to localize the ApplicationBar
                //BuildLocalizedApplicationBar();
            }
            
            async void MainPage_Loaded(object sender, RoutedEventArgs e)
            {
    
                server = new StreamSocketListener();
                server.ConnectionReceived += server_ConnectionReceived;
                await server.BindServiceNameAsync("8080");
    
                web.Navigate(new Uri("http://www.nokia.com", UriKind.Absolute));
                local.Navigate(new Uri("http://localhost:8080", UriKind.Absolute));
    
            }
    
            async void server_ConnectionReceived(StreamSocketListener sender, StreamSocketListenerConnectionReceivedEventArgs args)
            {
                DataReader reader = new DataReader(args.Socket.InputStream);
                reader.InputStreamOptions = InputStreamOptions.Partial;
                uint numStrBytes = await reader.LoadAsync(512);
                string request = reader.ReadString(numStrBytes);
    
                using (IOutputStream output = args.Socket.OutputStream)
                {
                    string requestMethod = request.Split('\n')[0];
                    string[] requestParts = requestMethod.Split(' ');
    
                    if (requestParts[0] == "GET")
                        await SendResponse(requestParts[1], output);
                }
            }
    
            private async Task SendResponse(string path, IOutputStream os)
            {
                using (Stream resp = os.AsStreamForWrite())
                {
                    string body = "<HTML><HEAD></HEAD><BODY><P style=\"font-size:initial; color:#0000FF\">If you see this, the StreamSocketListener is working.</P></BODY></HTML>";
                    string header = String.Format("HTTP/1.1 200 OK\r\nContent-Length: {0}\r\nContent-Type: text/html\r\nConnection: close\r\n\r\n{1}\r\n", body.Length, body);
                    byte[] headerArray = Encoding.UTF8.GetBytes(header);
                    await resp.WriteAsync(headerArray, 0, headerArray.Length);
                    await resp.FlushAsync();
                }
            }
        }
    
    }
    The xap file attached:
    LocalServerTest_Debug_AnyCPU.zip

    Please test on your devices and let me know how it goes.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  14. #14
    Registered User
    Join Date
    Oct 2013
    Posts
    22

    Re: StreamSocketListener not working on Lumia, but Ok on Samsung Ativ

    Hi Lucian,
    Code:
    web.Navigate(new Uri("http://www.nokia.com", UriKind.Absolute));
    local.Navigate(new Uri("http://localhost:8080", UriKind.Absolute));
    how is web and local declared?

    edit: ok, its a WebBrowser control..

    Tom
    Last edited by Tom_nam; 2014-02-20 at 11:22.

  15. #15
    Registered User
    Join Date
    Oct 2013
    Posts
    22

    Re: StreamSocketListener not working on Lumia, but Ok on Samsung Ativ

    Lucian, your test is also working for me on a 520 without connection.
    Since my use case is actually the StreamSocketListener in combination with the Here-Map-control, I'm busy now extending the test to reproduce this behaviour.
    Tom

Similar Threads

  1. Lumia 1520 highest cam resolution not working in my app
    By protonhead in forum Windows Phone Imaging
    Replies: 6
    Last Post: 2013-11-29, 16:04
  2. Intranet on Lumia with regular design not working
    By gilperon in forum Windows Phone General
    Replies: 4
    Last Post: 2013-09-08, 12:45
  3. Updates for Lumia 920, Lumia 820 and Lumia 620
    By hamishwillee in forum News and Announcements
    Replies: 0
    Last Post: 2013-03-15, 03:13
  4. Samsung sgh-i550 bluetooth not working
    By pvh123 in forum Symbian
    Replies: 2
    Last Post: 2008-10-01, 18:05

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×