In actionscript3 I am able to create a p2p network and send arbitary text data around. While this works fine in a network of flash clients I would like to connect a non flash client written instead in c# to the same p2p network.
Is anybody working on such a thing already? Are there any articles on how to do it?
i think the most simple thing really is to create a C# client that'll embed an SWF for communication purpose ... communication between C# and SWF can be done easily through local connections ...
otherwise, you will be having a hard time ... i summarized how flash p2p works in a related question ... there is an awful lot of net-code you will be having to write (starting with the whole protocols that stratus alone uses, and then reimplementing the whole p2p protocol based on UDP, which secures data much like TCP does, and should not be a twoliner) ... i'm not saying it is not feasible ... but it seems unneccessarily uncomplicated ...
greetz
back2dos
Related
I am attempting to make a chat application on the .NET framework that will be able to communicate over the internet and not just LAN. I would like it to be P2P as to not require a central server. I don't mind which protocol it uses (UDP, TCP, etc) so long as I can send messages to almost any given IP.
All I would like to know is how to send data to another IP I know of, nothing else. I've searched around but the code is too complicated for me. (For example I've looked at the source code for torrent clients).
Help will be appreciated a lot thanks.
P.S.: I've heard about a method called UDP hole-punching if that sparks any plugs.
There is a small issue with your plan.
The server-centric approach does not serve only as a slow middle man, but also as a central point with known address to connect to, an anchor in the sea to attach to and clients connect to the static IP/name of the server.
Usually, users do not care what is their IP address on the internet...
So at the minimum, the server is good to get list of clients.
Nowadays you can use some services from Microsoft or Google or other.
Now rest of the P2P communication of clients between NAT comes with more learning: TCP_hole_punching
I would suggest reading all that stuff then look for some code or library that does it.
Here is older topic similar to yours looking for the hole punching library: tcp hole punching library
I have answered similar kind of things here Peer-to-Peer application using java, let me know if it helps or if you have any specific question about this. Basically you need NAT traversal, so you would find many different ways to achieve this based on your need. Even you can achieve this simply configuring your router by enabling UPnP.
I am trying to make an online game application, which communicates with another pc peer-to-peer over the Internet.
Since both pc's are likely to be under NAT, and since I cannot afford an external server, I thought the only way is to use free STUN and TURN server, such as Numb.
However, after some research, I couldn't figure out how to use those servers to make a connection.
Is it really possible to use only those servers to do it? If it is, how would you do that?
Or is there an easier way of doing that?
I can use either UDP or TCP for this.
Take a look at the Internet Gateway Device Protocol. Is is an extension to the UPNP protocol, is very easy to use, is supported by pretty much every router out there and there are some free libs implementing this protocol.
I googled now a few days and didn't find a good solution for me (maybe I am too bad...).
I have an C# application which have data what the iphone app wants.
So I am logging in on my iPhone app and the C# app should send data.
So I need a central server who handles the requests. But this is my problem I dont find a good solution.
If it would be in a local network I would do this with sockets. But I want to do this over the internet.
I read about php socket server.
But if I have a server with a static ip, can I run a self written C# socket sever on a vm?
Thanks for help!
You don't say how much data you want to transfer. If it's not that much, you might consider a message queue. You can set up a free account at http://www.iron.io/mq to test with. Their free account is pretty generous, so depending on your needs, it might work as a permanent solution as well.
I have a server & a client. The client is my Android phone. The server is my PC running Windows.
I'm needing to find out the best programmable method of sending a short string to the PC and having it displayed real-time.
Please keep in mind the only languages I can program in on my server-side is VB.NET, C#, and C++ (and my experience with them is in that order).
Edit:
I don't care about security or anything. Both devices will be on a private wifi network. I can't rely on 3rd party applications though, considering the computer running the server will have very little RAM.
If it's just a simple string, and you don't care too much about security or reliability, you could go about this using java.net.Socket. Create a Socket, giving it your PCs IP address, an open port, etc. Write up an application on the PC to listen to that port, and handle the data as it would. I have no idea how you would go about doing the server-side part, as I've only really used Java, but it shouldn't be that hard if you're going with raw sockets. With the Socket on your android, create an output stream, and pass the string through that stream.
If you need a more secure, more reliable, more standard protocol of delivering a string, I'd probably go with HTTP. You might have to read up more about it, but they're better overall. Sockets aren't a whole lot simpler, though.
You can write a .NET project which communicates with sockets. Your PC could listen to a given port and your phone would access that port. This article might help you to learn more about .NET socket programming and you will be able to use C# or Visual Basic as you want.
I am currently writing an application having a client server architecture.
The client is a Java android application
The server is a C# application.
The client will pull data from the server but in some cases push some data to the C# server as well.
The data that server needs to forward the clients is list of data structures (perhaps in the form of XML?), sometime binary data like files.
The client and server are communicating over a wireless network.
Speed and scalability is my top most priority in the design of the system,...
I have to write server as well as the client myself. I will be using sockets for communication.
I need your advise on the form of protocol I should use to exchange data between the Java client and C# server.
Should I write similar data structures (which seems redundant) in java and C# and serialize them ??
or should I exchange xml ??
I am not sure yet what is the best way to do it ..
Essentially there will be commands from client and server will respond with data
Please advise me on this topic the data communicated could be be as large as several gigs over wifi so speed is very important.
Well, there's always JSON. It should be well-supported on both ends and is easy for your server to generate and client to consume. Not sure it helps with your bandwidth concerns any...
I believe WCF might be approperiate for this, WCF uses soap so a Java implementation should work well. WCF also supports steaming, so transferring large files is possible, though I'm not sure if Java supports the streaming protocol.
As for performance, you will probably be limited by the speed of the device and not the protocol.
Have a look at this session from TechEd 2011: "My Customers Are Using iPhone/Android,But I'm a Microsoft Guy. Now What?"
http://channel9.msdn.com/Events/TechEd/NorthAmerica/2011/DPR304
It would probably be worth looking into MonoDroid if you want to share code between client and server (and if serialize/de-serialize makes sense).
As I don't know what you're building, I would advise you to read up on REST before you continue though. It should give you valuable pointers on how to create a nice API that can be easily consumed by various clients.