hi guys,
as part of my online game I need the server to always wait for variables that will come.
I am using the "Socket s = myListener.Accpet...blabla.."

the problem is that when I call Server.cs class the application freeze, 'cause its waiting for variables...

I want it to listen always in the background like it is separate application.

any advices ?

Recommended Answers

All 2 Replies

I don't know how you've coded your server class but you have 2 options for listening for clients either use AcceptSocket method from Sockets.TcpListener class or use BeginAcceptSocket. BeginAcceptSocket will require you a callback if a new tcp client is connected on your server. In AcceptSocket method, you need to implement your own thread for incoming connections. Msdn has enough information for you to start with. You can search on the methods I help you decide what kind of implementation you need.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.