Local Server for Gaming C# [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
[C#] Hello all, I am curious on how I can go about creating my own local server and allowing people outside to connect an return data stored on it. I am not looking for an "XNA" solution. I would like to kind of digest the bare bones of client to server. Here is an outline for what I am looking for:
My PC
[Server] -> Constantly Updates/Receives Player data so it can be obtained by other PC's. Stores data from other clients.
[Client PC] -> Writes to server (Creates new player data/updates) and obtains further information to update visuals, other players, etc.

This isn't something small that anyone can just do, especially if you are just getting into programming. I would first start out small, make a few smaller applications, play around with the .NET framework libraries and get comfortable (I would specifically look at System.Net/System.Net.Sockets as well as possibly System.Security for SSL encryption). The networking component will be huge in this as you'll need to implement a system to handle the constant communication and be able to respond quickly (any lag can be seen as dropped packets from a networking standpoint and cause client time outs). You'll also want to think about what kind of data you are serving up (saved games, player data, whether it's personal information (such as passwords, email addresses, etc)) and how you are going to store that data. There are many paid and free technologies for this (Postgres, SQL, MySQL, etc). Please do a quick google on some of thee items I have mentioned and you'll see why it takes years to develop games and the back end systems to support multiplayer.
If you are the type of learner to plug things in and learn by tearing someone else's code apart, I would take a look at some of the articles below.
http://www.codeproject.com/Articles/1415/Introduction-to-TCP-client-server-in-C
http://csharp.net-informations.com/communications/csharp-multi-threaded-server-socket.htm
Here's some MSDN articles dissecting the different classes of the System.Net namespace and functions of it.
https://msdn.microsoft.com/en-us/library/system.net(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/system.net.sockets(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/system.security.cryptography(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509certificate(v=vs.110).aspx
You'll also want to look at using threading to make sure the server isn't only processing one request at a time. There are many approaches to this but here is some basic examples of using threads.
http://www.dotnetperls.com/thread
When to use Multithread? (Some pointers how on and when to use threads on our very own S/O site :) ).
Here's the DL on threading from MSDN
https://msdn.microsoft.com/en-us/library/system.threading.thread(v=vs.110).aspx
Not meant to discourage you but more to show you the type of effort you'll have to put in to this sort of project. What you want to do is completely doable, but will require some brain training and head scratching. Apologies if it sound condescending, just trying to coach and am unsure of your level of expertise in c#! Best of luck to you though friend, hopefully this turns into a great learning experience!

Related

Basics of real-time multiplayer game [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to create a simple multiplayer game. As I understand the main principle is to make clients communicate ether directly to each other or to the server. Since I want some game data to be available online on my website, I'm inclined to create database that users will be connected to.
Is this valid?
Is SQL/MySQL good idea to use in such scenario?
Would windows azure be any help?
Please help me. I really need some guidance here.
If you want to store game data for use on a web site, you will definitely want to store it in some sort of database. Just so you know, SQL is a querying language for databases, MySQL is a DBMS (Database Management system) that you use SQL to "talk" to.
However, you certainly don't want to store ALL of your game interaction in a database, as database operations tend to take a long time (at least as far as a computer is concerned). Your server should have some sort of socket (probably TCP) that is talking to all the clients, passing messages and so forth.
The class reading from this socket would raise events or otherwise update the database for the information you want to be displayed on your website. Windows Azure would be a perfectly valid hosting platform for the website/server app, and so would pretty much any other web hosting solution. Some of the socket code could be easier going through Azure, so that may give it an advantage when choosing your host.
Please let me know if I can provide any more information.

Developing a program that serves as a web program in C# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm not sure if I'm going to be able to explain it right since I'm quite sure I don't know the correct terminology involved with it, which is also why I'm having a difficult time Googling for answers.
Essentially, I'm looking to develop a program that serves as a web site. It'll run constantly (like a service) and will return HTML when an outside user sends an HTTP request thru a browser or similar to a specific port on the computer this program runs on. Basically, this program will perform various background errands throughout the day but I want to be able to expose a web front end (almost like how you would with standard WinForms, but I want to be able to access it remotely) to be able to configure it, check the status of tasks, and otherwise interact with it.
I'm looking to use .Net, but I'm open to using something more universal like Java too. Someone with experience in this area would be helpful to explain any pain points you've encountered and suggestions on how to get started.
You can do it in C# with the HttpListener class.
I published an example some time back. See A Simple Http Server.
Although you might consider whether you really want to operate at that low level. I have written a fairly complex server based on HttpListener, and if I had it to do over again I'd probably just bite the bullet and use ASP.NET. There is a bit of a learning curve, but unless your server is incredibly small and simple, an ASP.NET application will be a lot easier to write and will likely be more robust.
Here is a simple example on how to do it in C# using the HttpServer class:
http://www.codeproject.com/Articles/137979/Simple-HTTP-Server-in-C
You are doing at least 2 different things, so you should probably create a Solution in Visual Studio.NET with one project for each purpose (You can have many projects in a solution), probably with at least one Data Access project as well (of type Class Library). If the solution does things at certain times of the day, then those can be Console Applications that run through task scheduler, rather than one of more services. Services are better suited to things other than simple scheduled tasks. A Web Application project can serve up your html.

Can someone suggest an online solution to communicate between development team and beta-testers [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I was wondering if anyone can suggest a third-party solution to do the following?
I'm a developer/freelancer. I need an online solution to let beta-testers and other developers communicate bug reports, submit feature requestes (from "internal" beta-testers, and just not software users) back and forth between our small team. Preferably the system that can be updated from both ends: developers - beta-testers, that could also keep history of all such communication.
I have a webform to a local mailbox that triggers a mail to my personal account when there's something to read (that means: when unread inbox messages count changes from 0 to 1). When the message requires an answer I send an email to the user (users are required to provide a valid email on registration).
In extreme cases I leave a personal message to the user popping as a simple javascript alert next time he/she logs in or (if already logged in) requests a page. If I need to make sure he/she will read it I use confirm method and keep showing it in every page loaded until accept button is pressed.
You can set up a free online chat applet on a webpage to complement that. Check this one out, for example: http://www.phpfreechat.net/demo
Facebook also works quite good (instant messaging, posting to everybody).
A Blog with RSS (any CMS: wordpress, drupal... includes a number of modules to set up a blog in a minute with just a few wizard steps) is also a good way to communicate news and updates.
A Forum (phpBB for example) is very easy to set up, but more difficult to maintain (repeated posts, scattered info without structure, etc... It's less resource efficient than other systems, in my opinion).
A wiki is a good solution for FAQs and user manuals. You can read more about it here: http://www.wikihow.com/Start-a-Wiki
A dedicated Q&A site can also be a good idea because people vote the most interesting and useful topics, but it has the same drawbacks as the forum, though they're (in my opinion) easier to handle. There are many precooked Q&A opensource projects with almost if not all the functions you can find here on the stackexchange network, ready to deploy in a minute. I particularly like this one: http://www.question2answer.org/
A bugtracker is quite technical but it works as a charm with experienced users (If your beta testers belong to the programmers community don't even think it twice: just have it online ASAP!). I like bugzilla, but you have many different ones to choose from. A comparison of bugtracking systems can be found on wikipedia: http://en.wikipedia.org/wiki/Comparison_of_issue-tracking_systems
Finally, but not the less important, don't discard deploying surveys, they're very good to make statistics on your project's weak and strong points and also on user experience and expectations (functionalities to add/improve and fix). Some sites like surveymonkey.com make this very easy.

.Net realtime software licensing [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I've made a program that I need to license before selling it to customers. Since I'm not sure, that it will gain me at least the cost of commercial licensing software, I would not like to buy one.
So I'm looking for advice on how to implement licensing feature with following logic:
All license keys are validated on server side each time application starts (no licensing info is stored at userside except the license number).
There is only one application running with one license key at the same time.
What I do not know is how to protect my program from simple decompiling/disassembling and just removing a call to check license? Or making own server that will make a response true on each license? How does such security normally made?
I've searched for free SDKs or something like that, but could not find anything.
I'll be very thankful for your help!
P.S: I do not aspire to make the system "indestructible", but I would like to receive the protection that is more expensive to crack than paying $5.10 for a copy of the program.
P.P.S: Sorry for my bad english.
What I do not know is how to protect my program from simple
decompiling/disassembling and just removing a call to check license?
Or making own server that will make a response true on each license?
How does such security normally made?
You are confusing licensing and obfuscation. To prevent the above, you will need to obfuscate your exes and dlls using an obfuscator.
Since I'm not sure, that it will gain me at least the cost of
commercial licensing software, I would not like to buy one.
IMHO you are much better off focusing and spending time on your actual software than in developing a licensing scheme from scratch (re-inventing the wheel as they say).
If you do open up to paid solutions, take a look at CryptoLicensing (for licensing and copy-protection) and Crypto Obfuscator (for obfuscation and code-protection).
DISCLAIMER: I work for LogicNP Software, the developer of above mentioned products.
(Sorry can't comment on other people's posts???)
It depends on what your application is doing.
I'm currently faced with the same problem as you. I'm going for a log in system, simply fetch and compare to what's in the database. If not present do not launch app. Not that I need more, the application relies on my database and without it it is useless.
Then they can spend a couple of hours figuring out what my database looks like based on what they see on queries or practically rewriting my entire product. I'm going to spend little on in app security. The only protection I wish to have is not to show my server's data.

C# P2P Instant Messenger General Basis Help [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I want to start a simple windows P2P instant messenger in C#, similar to AOL, ICQ, etc, but much more simple (plain text messages between 2 guys)
I don't need examples on how to do it. I can find them myself.
What I do need is a general idea of how instant messaging works (P2P, not multichat) without many technical details.
For example:
Will I need a main server to make the communication between user1 and user2 happen or user1 can send the strings directly to user2? How is this called?
If user1 is logged in, how does he know of an incoming message from another user (or the online status of their friends)? Does the chat client app check every X seconds with a main server?
Any clues that might help me clear the general data flow idea will be very much appreciated.
A flowchart may also be helpful if you find one to share.
Thanks in advance.
UPDATE (NEW QUESTION) - July 6
Let's say the user had successfully logged in, and the app needs now to get and populate the list of contacts (saved on my apache/php/mysql server).
How would you implement the data retrieval (important) and later population of the contacts list? Is WebClient.DownloadString[Async] a good approach? Is there a better way?
How often should the app check for updated list (online/offline statuses). Recommendations accepted.
How can I parse JSON data on C#.NET (Visual C# Studio 2010)
I will get JSON strings.
Thanks!
If you really want to build a p2p app, there should be no server. However, this is not straightforward.
There are lots of different approaches to creating a chat system, mostly involving servers. Research comet (a good solution if implemented properly, terrible otherwise), polling (checking every x seconds) or using sockets, however there are lots of issues to be considered - and caveats, particularly firewalls/nat routers. A socket solution could potentially be 'p2p', but the polling and comet ones are not.
For your use case, I would go with a simple socket solution (one side as server, one as client) and configure your router firewall by opening a port at the server end.
You could extend this so that both sides could be both servers (listening on a port) and clients, so you could both 'call' each other.
You will need to have a permanent ip, or use a service like dyndns to get this to work properly.
Update
Yes, DownloadString or DownloadStringAsync would be a fine method.
How often is really up to you. I assume that this is only for a few users from what you said in the question, so you don't need to worry about overloading the server. Once a minute sounds reasonable, but once a second would proabably be fine too if you feel that way inclined... Parsing JSON in .NET answers your final query.

Categories