07
Apr
12

Streamsocket example c# metro

This post has moved to http://peted.azurewebsites.net/streamsocket-example-c-metro/

About these ads

12 Responses to “Streamsocket example c# metro”


  1. 1 jokeefe
    July 20, 2012 at 7:16 pm

    Thank you! I was having trouble reading input from a StreamSocket until I saw how you were using InputStreamOptions.Partial. My problem was that I was trying to read a smaller input with too large of a buffer, so it was hanging indefinitely.

  2. 2 John Baird
    August 24, 2012 at 11:12 pm

    I’ve been having trouble with a project i’m working on. It throws a datareader/datawriter error saying “the object is closed.”. I downloaded your project and ran it and am receiving the same error. Do you know anything about this? Any suggestions?

    To duplicate it, try listening, connecting, send 1 message, reply 1 message, send another message…

    Thanks…

  3. October 14, 2012 at 6:14 am

    Hi Peter,
    This may be misunderstanding StreamSockets, but this is all well and good – and I have your sample running, however the chat client and server are within the one application? Wouldn’t I need to host the ‘server’ component on a server somewhere on a windows service or something?

    I try to implement the server code on any other project type, WPF, console app etc. and I can’t find Windows.Networking namespace.

    Now I’m really confused, I wouldn’t want the server to be another Windows Store app?
    Hope you can shed some light on this!

    • October 14, 2012 at 6:14 pm

      Hi graham,

      Yes, I could well have separated the code into distinct server and client parts. I just wanted to show both parts of the code from a winrt perspective and having each endpoint act as both seemed simpler to me. In general if you want to code either client or server in a different technology then you would need to use the stack which is available in that environment. In this case though you can use WinRT apis from .NET desktop applications. I have an example in my latest post which shows a WPF socket server working with a a metro client see http://babaandthepigman.wordpress.com/2012/10/12/metro-app-and-kinect-voice-control/

  4. October 15, 2012 at 5:18 am

    Ah, awesome. That makes sense, thanks. I’ve also since been looking at trying to use it with the Microsoft.WebSockets NuGet package too. Will take a look at your WPF client, thanks.

  5. February 13, 2013 at 2:22 am

    Is it necessary to send/recv the size of the message? I’m trying to get the listener to work with a telnet client and its giving a bit of trouble.

    • February 17, 2013 at 6:00 pm

      It’s not necessary to send the size of the message – this is just a way of ‘framing’ the data (you need some way to determine the beginning/end of a message)

      • February 17, 2013 at 6:36 pm

        I’m trying to make a simple test server using StreamSocketListener that I can telnet to. For some reason the telnet client cannot connect to it. Netstat shows there is a tcp connection listening on the port I chose. Any idea? Have you by chance used the listener and connected a telnet client to it? I’ve done this before using .net tcplistener w/o issue.

  6. 9 George Hailazopoulos
    April 23, 2013 at 4:06 pm

    I separated the code into client/server but i could not get it to work.
    When i was trying to connect from client to my already running server i was getting an error(due to time out i suspect my server was unreachable) .I tried localhost and ip and different ports but i had no luck any ideas on what i may be missing?

    ++I think your facebook link does not work although i connected through i was unable to post a comment++


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: