locked
Communication with stream socket: Windows 8.1 Store app

    Question

  • Hi -

    We have to create a windows 8.1 store app that can communicate with wisnap wifi dongle.

    We followed the sample code from Microsoft link (mentioned below) but it is partially working for us. The connection is being established but we are not able to read the data from the stream. I am unable to paste the link here).The length of data being read is coming out to be 0 . 

    http://msdn.microsoft.com/enus/library/windows/apps/xaml/jj150599

    Code:

     DataReader reader = new DataReader(clientSocket.InputStream);
                    // Set inputstream options so that we don't have to know the data size
                    reader.InputStreamOptions = InputStreamOptions.Partial;
                    Output.Text = reader.UnconsumedBufferLength + "";
                   await reader.LoadAsync(reader.UnconsumedBufferLength);

    Here, Output.Text is displaying 0 and after this our application is crashing.

    Appreciate if you could provide your valuable inputs to help us fix our issue.

    Thanking you in advance.

    Wednesday, December 17, 2014 12:17 PM

Answers

  • Hi Shikshri,

    According to your description, you can connect to wifi dongle but cannot read data from it. I assume there should be some restrictions when reading data. Maybe you need to send something like certification to let the dongle knows the connection is authorized before receiving data. Please contact the supplier of dongle to check this.

    Here is the complete code sample for stream socket, it contains server side and client side. Please refer to see more information. https://code.msdn.microsoft.com/windowsapps/StreamSocket-Sample-8c573931.

    Please feel free to let me know if you have any concerns.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Thursday, December 18, 2014 7:02 AM
    Moderator