Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6994127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:51:10+00:00 2026-05-27T19:51:10+00:00

I’ve started playing with sockets and have started on a small game for testing

  • 0

I’ve started playing with sockets and have started on a small game for testing purposes. The server is asynchronous and it’s working good, but not great, so i’m looking for pointers from people who’ve gotten good results in their apps.

Scenario:
In the app i’m connecting to the server in Application_Launching/Application_Activated and disconnecting in Application_Closing/Application_Deactivated.
I noticed that in the “Tic-Tac-Toe Over Sockets Sample” on MSDN they’re closing the socket on the server every time when data has been sent to the app and connecting every time before data is sent from the app to the server.

Discussion:
Do people prefer to manage the connections in the app lifecycle events? It seems rather odd to open/close the sockets for each operation, like they do in the samples. Seems to nullify the advantages of using sockets in the 1st place.

Scenario:
Let’s say we’re implementing some sort of matchmaking method, which is relatively long-running. Let’s use 20 seconds as an example.

Discussion:
When the client asks for an opponent, would you prefer to loop the client list and sleep periodically until a suitable opponent has been found? Or would you recommend just adding the client to a pool of clients looking for opponents and loop through this periodically in a separate thread?

Bottom line is that if someone has successfully implemented a Windows Phone app/game using sockets i would love to get info on how you handled things like:

  • Connection lifecycle
  • Long-running operations on the server
  • Clients quitting the app at “any time”, including when doing long-running operations on the server.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:51:10+00:00Added an answer on May 27, 2026 at 7:51 pm

    About the open/close:

    MSDN sample in which it closes the socket after each operation is a neat practical method which most people might use. however there is no right way in socket programming. in fact there are a lot!

    About threading:

    • If you’re using (synchronous) blocking methods such as Listen then loop and sleep is a bad idea. you can’t cancel a blocking method.
    • If you’re using (asynchronous) non-blocking methods such as BeginSend or BeginListen
      then threading is not needed.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.