C# Create Dht Network(monotorrent dht lib) - c#

So I wanted to add dht to my server and clients. And I looked into monotorrents. And it seemed straightforward but I'm wondering how I could make my own like sort of "torrent" to which all my clients can connect and then the servers that are connected are waiting for connections and the clients ping them to connect. So first i want to make 1 server a node in it already, and I thought I'd go with an infohash, but that didnt seem to work, if someone could just point me the direction? Sorry I'm really new in this p2p dht world. I did find a proper way to ensure that communication is really going where its intended to go, which was already hard for me
thanks in advance

Related

c# - hiding a password for an SSH connection on a locally-run application

First of I'd like to say thanks to this community that has gotten me as far as I currently am programming in c#. I'm teaching myself as I go and not really doing any formal training so you guys have been a great help.
I'm writing a small application that is intended to make one of the mundane tasks for upgrading a piece of equipment my company sells a bit easier. Typically these devices are not connected to the internet, and we need to remote in to a customer's computer to accomplish the task of connecting to their device over SSH and running some commands once logged in to do the upgrade. I'm hoping to distribute an app to the customer, and an encrypted key (generated on our side) that has information about the options they are upgrading, and the serial number to ensure the key can only be used on their device.
In my app, I'm using SharpSSH to accomplish to initial SSH connection which is working great. However my concern is that the root password on our device is actually a fairly simple one. The devices themselves have rather limited functionality so not much someone could do if they got on it themselves, however if they got on the device they could upgrade theirs and anyone else's device if they so desired.
So my question is, how could I best 'hide' the password in my script so it's not easily searchable by anyone with a decomplier?
Right now the code is simply,
SshStream ssh = new SshStream(ip, "easytoguessuser", "notsocomplexpassword");
So I'd like to hide the password somewhere, but I can't think of a method that means someone with a decompiler couldn't just open up the exe and look for where the password is, or how I derive it from somtething else...
Like with real world locks you can't keep someone with the right tools out. You only can make it harder.
This can include:
store the password in an encrypted string that is only decrypted shortly before it is used
obfuscate the source code so it is harder to determine where the connection is initialized
This wont make it safe, but it hinders the less determined folks.

dynamic binding between processes

I'm trying to create a system that will be very modular. with the idea in mind that no module should really know about any other module (each running in it's own process).
There will be another program that will open, and will be able to tell what these modules will send and receive(this I largely have covered).
the issue I'm having at the moment, is there a way for me to be able to interrogate the application inside another process, or app domain? and in so doing late bind these modules together.
EG:
A module that can broadcast 'X' at runtime will be liked to a module that can accept 'X'.
This may be quite vague, and if so please ask me to clarify on anything I have not covered.
Right now, I Just need to know if it is possible to interrogate a process, and if so how? I Am fairly new to this but my initial research hasn't taken me to far.
I modeled a system like this recently for a personal home automation system. Basically, I'd want to be able to have certain sensors (microphones, cameras, etc.) broadcast what they have, and have other computers or programs get that information whenever they need it, without knowing exactly who is going to be getting the data at compile time.
If this sounds like what you're looking for, I'd look into a Pub-Sub style architecture.
http://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern
You're not really interrogating the process in this kind of architecture, but I think you get a similar result. Basically, you'll have one main pub-sub server.
In the Diagram above, Clients 2 and 3 "subscribe" to receive a specific kind of message. The server knows who is subscribed to what, so that when Client 1 sends that message, the server knows it needs to route it to the correct clients.
I hope this helps.
EDIT: After re-reading your question, I feel that you may have already gotten this far. Maybe all you need is something like
http://msdn.microsoft.com/en-us/library/bb546102(v=vs.110).aspx
Pipes allow you to pass some information between processes. You'll have to serialize and de-serialize the data across the pipe, but this (coupled with a pub-sub architecture) should give you what you need.

Stream audio to several clients

I am making a website using ASP.NET and i have a webservice using WCF.
I need to figure out how i can stream audio(.mp3 files most likely) to several clients, so that all the clients hear the same, at the same time. I know this can be done using sockets, but I need a lot of different streams(which is not so good with sockets as i would need a new port to every stream, as far as know).
It is a kind of online radio-ish. Several channels, and users can then listen to the one they want.
Can anyone help me or point me in the right direction for something like this?
It does not have to be through WCF, I just need to figure out some way to do this
A quick way to get started with this is to just use SHOUTcast or Icecast.
They both work very similarly, providing an HTTP or HTTP-like server that streams MP3.

TCP/Telnet connection Winform to Winform c#

I wish to simulate a connection between two forms in an application (it's a telephone network simulator).
I want to go beyond using simple methods to pretend there is a connection (IsEngaged(), IsConnected()) and somehow create an actual connection between the forms (telephones).
Am I correct in thinking I should be able to do this via telnet/tcp?
I'm not asking for a complete solution but would appreciate a nod in the right direction. All of my searches so far have come up with nothing similar to my scenario.
Many Thanks
I wouldn't bother with telnet - implementing Telnet is rather "hard work"...
For simulation purposes you can mock this with TCP or UDP or named pipe - anything usable for (bidirectional) IPC should work...

How does this code work? (a tale of MUD server baffle-ry)

I found some sample code establishing a multi-threaded chat server, written with the intent of being expanded into a simple MUD on this website: http://bytes.com/topic/c-sharp/answers/275416-c-mud-telnet-server
The thread is quite old, so I can't ask any questions there, so I figured I'd turn to the kind folks at stackoverflow to help explain something to me.
Before I get into writing a MUD, I'd like to understand how the above code (which I intend to use as a base to get started) works, so I can modify the basic architecture if I need things to work differently. What I don't understand though, is how it can be starting new threads with each Connection which instantiates its own ArrayList of connection, which it only adds itself to, but still communicate with other users.
I'm assuming it's some basic lack of understanding of how threads work or something of the sort, but no matter how long I stare at that code I can't figure it out.
Thanks in advance,
HJD
Ah, the ArrayList in question is static, which means that it's shared by ALL instances of the Connection class.

Categories

Resources