C# application control local network iOS - c#

I'm in the middle of the process of making an application on Windows in C# and I want to make an IOS and an Android program. Things are going well, but I'm kind of stuck on implementing the requirements for proper network communication.
I've searched a lot on sockets and I'm quite sure that I have to use that but I don't know for sure. I can't really find much about it. So I was wondering if you guys could point me in the right direction.
So my question basically is how to establish connection and send the proper functions.

You probably looking for an RMI Framework. (Remote Method Invocation)
What it basicly does is it's calling methods from other applications.
For example: on your pc you call rmi.DoDisPlayMessageOnPhone("Hello!")
your application on the phone will execute that method (you implemented -duh-).
It makes networking simple and you don't have to bother about networking that much.
Here is an RMI Framework that I use too:
SimpleClientServer (Scs)
It has a great example. Just read carefully and you will have networking in no-time :P

Related

C# socket client-server libraries (Nuget/other?)

I want to start writing games/applications with client-server architecture. I explored the internet and everyone tells that the best way is to use c# built-in socket libs. But If I am forced to write everything on my own (singletons, threads, keeping connection alive, parsing in-out messages etc.) I bet I will do it for months. Do you know any library supporting client-server based connections for C# (Forms/WPF/maybe Mono)? I can not find any "quite new" threads/information about this.
i think your problem will be, that you will not find an predefined lib which fits your requirements.
But if you write it with Visual Studio autocomplete will help you a lot.
However there are lots of question for me. What exactly is your target? What kind of game do you thinking of?
These factors affect your complexity of your "socket" enormous.
I think for a small "Ping Pong"-Multiplayer-Game your Socket is quite easy to do.

What are the different between Super Web Socket and Nugget?

I have implemented my application in C# with use of Supper Web Socket the.NET implementation of WebSocket server. I have heard about the Nugget which is another .NET Web Socket server. What are the key differences? I have been to the website 'nugget.codeplex.com' but could not find useful info. I would like to know from someone who had experience with Nugget.
http://nugget.codeplex.com/documentation
Websocket server: onopen function on the web socket is never called
http://www.undisciplinedbytes.com/2010/06/html-5-c-web-sockets-server-and-asp-net-client-implementation/
http://jxs.me/2011/05/28/csharp-websockets-with-fleck/
A simple Google search came up with this. Please understand that there is a vast multitude of services and libraries in existence and the best way is not to demand expertise but to call on someone who might have some, if any knowledge. Try to implement both along side each other yourself and see the differences based on the documentation. My guess will be that there is very little difference except for how the code is wrapped or the algorithmic approached. Both, if they do the same thing, should do what you want them to fairly well. Its Apples and Oranges.

How to write an client-server video streaming

I'm working on project that will work real time: I have to write a video streaming client-server app, this server will to send the AVI/MPEG etc to an web application. I have some questions:
What is the protocol recommend to do this, http? rtp? or other?
In the web application, how do I to show it to user? using an flash player,java applet(I don't ensure if it's possible with it) or HTML5, what is the best way to do this currently?
I hope this is clean for you. Any help is very appreciadted. Thanks in advance. :)
There are several different ways to implement this (some that require programming and others that don't). Which one you choose depends on your requirements.
Red5 is an obvious solution which will allow you to only have to focus on the web side as long as your player of choice is flash.
FlourineFx provides a similar environment for .NET with a little more effort.
I've also done this with IIS and a custom server using HttpListener with much success if you're set on a pure Windows/C# solution. The caveat I'd add here is that it isn't always simple. In an environment with limited throughput, you will have problems since HTTP doesn't have the time corrections that RTP/RTMP/RTSP have but in a decent network it works 3 9's of the time (I've only tested with a single player though).
UPDATE
If you're talking about live streaming with .NET I'd suggest looking into the DirectShow (or related DirectX) API's. There is a wrapper for it for .NET available called DirectShow.NET.

ASP.NET: Implementing a client server solution (for chats, iterative fights ect)

I have a quite advanced application, where I need to add some client/server functionality. Some examples of functionalities is:
Chat
One vs. one fight in a browser game
Draw people on a map
I am creating this application in ASP.NET and AJAX. I do not use Silverlight/Java Applet/Flash or anything else. If possible, I do not want to change this for other reasons.
I thought about creating some kind of game server, and then communicating either web services or TCP protocol: But I have NO idea if this is a good idea. Also, I don't know how to do this.
So my question is:
What's the best way to implement this? And is it even possible? And if it is, could you give a reference or two?
Thanks a lot,
Lars
For doing chat & multiplayer games, the crux of the problem is in getting the server to asynchronously send messages to the client. This can be accomplished by a method called reverse-Ajax (or commet). Here is a simple example for how to do reverse-Ajax with ASP.NET. This is a very involved concept (at least until we can use HTML5 WebSockets) with a lot of thought going into security concerns, et al. I assume that by asking this question you are already quite familiar with Ajax & browser scripting (if not, you have a lot of reading to do).
Tutorial on writing a basic chat server: (in c# no less)
http://www.dreamincode.net/forums/topic/33396-basic-clientserver-chat-application-in-c%23/
Sgive you a good foundation on server development.

Asynchronous Communication Between Two Applications

I'm writing a simple little game for my kids - it doesn't really matter what it does, though I couldn't tell you anyway, since I/they haven't quite decided yet! However, I think it will have a server component and a number of client components, and I'm looking at ways that the clients can communicate with the server.
ALL my previous experience... my entire career in fact... has involved the server element either being a database, a web server, or the two in tandem. Neither are appropriate in this case, so I'm curious as to what means I could & should use to communicate between the two.
Obviously, it would be preferable to adopt a technology or technique that I can re-use in my work, where I'm increasingly working with Windows Forms. I imagine there are 1001 different approaches I could adopt; it's a question of sorting the wheat from the chaff.
I've literally just started reading about WCF, but its unclear as yet, if this service-oriented approach is what I'm looking for.
I'm being deliberately vague about what the applications will do; I expect the client will announce their presence to the server, will feed user choices up to the server, and in return, the server will periodically update the client with what is going on in the wider game. The game will be turn-based rather than real-time... and quite low-tech really!
Suggestions? Ideally, with links to good learning resources if any are known.
Conclusion:
I actually thought there might be more viable alternatives; there is Remoting (now depracated), but the consensus says that WCF is the way to go - in my case, self-hosting looks appealing.
Thanks for the responses.
It looks like you're interested in WCF and that is a reasonable technology to use in this case.
When writing a network game the easiest approach is to use the client server approach here too. With WCF you have some different hosting possibilities, hosting in IIS or self hosting. I would go for self hosting to avoid the need for IIS on your home computers.
The service could be hosted in either a windows service or actually in one of the clients. I recommend running as a windows service. The service could very well run on one the same machine as one of the clients.
Edit:
If you want to host the server in one of the clients you could provide a menu option "start service" that starts a self hosted service on that computer (and automatically connect the client part to localhost). After the service has started you can present the computer name that you enter on the "other" computers to connect.
I would suggest to separate the service part into a separate project, then you can easily break out the service to a windows service later on if you like.
Edit2:
By the way, since WCF is driven by calls from the client you need to poll the server for changes. You can google wcf long polling or just long polling for methods to "push" messages from the server to the client.
Check out this article on creating a chat application using WCF -- http://www.codeproject.com/KB/IP/WCFWPFChatRoot.aspx
I've played around with this code in the past and the project was pretty simple to launch locally.
Here is a good book on WCF, which can help get you started. It has quite a bit of a learning curve (I still have barely scratched the surface myself), but I get the sense that it's a very powerful way to set up a service-based application. On the page I linked, check out the Examples link, which includes a bunch of code from the book, including Juval's ServiceModelEx, which has a wide variety of useful classes for working with WCF.
I'm going to go against the crowd here and suggestion NOT using WCF. WCF is a great technology for service oriented architecture, however it is largely written on the idea that clients will not stay connected to the server, but rather connect, send a message, perhaps receive a result, and disconnect.
There is a mechanism that can be used for long connected clients, but frankly, it doesn't work very well, has all kinds of issues and quirks, and is not very reliable in terms of knowing when clients have disconnected or not, or whether the clients know if they are still connected to the server. It's more of a bolted on solution that tries to shoehorn itself into the WCF model.
The other issue is one of firewalls. There can't be a firewall between the initiator and the receiver (or there must be an open port). That means you can't easily have two clients behind firewalls that want to talk to each other. You need some kind of exposed intermediate server that is open. While this problem applies to all solutions, it's easier to manage with straight TCP connections than WCF.
I'm not a huge proponent of rolling your own solution, but WCF really is overkill for simple two way communication between client apps.
I have not yet found a good open source network library for .NET. I know lots of people will chime in with various libraries, but every one i've seen is old and has various flaws. Most seem to be someone that ripped out their library from an app and tried to package it as a generic one, but leaving in all the assumptions of their app.
The problem is that recent versions of .NET have added lots of new network functionality, particularly in terms of asynchronous support. As of yet, i've not seen any libraries which implement these functions.
Anyone want to help me build a good, from scratch, network library based on .net 3.5+?
I would look at Remoting if I was you. It is fairly easy to impliment and you can definatly use it at work.
There is a tutorial on it here:
http://generally.wordpress.com/2007/05/31/a-simple-remoting-example-in-c/

Categories