I am looking for a solution/way to implement the dynamic port forwarding functions built into ssh (also known as the -D option). I have been reading for the last day, and I can't seem to find a reliable library to aid in this.
I found ssh.net which is a C# library, but its dynamic port forwarding is broken in such a way that its proxy handler does not forward dns requests breaking pretty much everything. I have patched the code to a semi working state, but it is not stable, and really slow.
I am looking into libssh right now and it has port forwarding options, although it does not have a dynamic option which spawns a socks server to use. I assume I would have to do this myself.
If that is so, do I have to have a socks server running on both the client and server, then just use a normal tcpip forwarding tunnel, or what. How would I attempt to implement this.
Overall, I want to find a way to achieve the same effects as the -D option on ssh or what putty does when it creates a tunnel. Any links or general information about this, or even code/library samples would be appreciated.
Other notes: This is for windows, so libraries that are cross platform or windows only will be needed. Also I cant seem to figure out how to compile libssh2 with mingw or cygwin so that library is not usable.
Thanks for your time.
I am looking into libssh right now and it has port forwarding options, although it does not
have a dynamic option which spawns a socks server to use. I assume I would have to do this > myself.
libssh gives you everything to implement dynamic forwarding using the SSH protocol.
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've been working with a Denon AVR-X1100W in an effort to find out whether or not I can ping it over a local network. For this, I am using C# in order to make a simple program.
How can I ping this type of device? A traditional ping command doesn't work, however, as it lacks an actual web server internally. I understand that a socket needs to be opened and, from there, a specific message sent with UDP.
Beyond creating a socket, I am unsure on how to continue.
I managed to find a great JavaScript-based library, denon-avr, that helped me connect to the receiver.
While this resulted in a change from C# to JavaScript, I found using JS to be much more agreeable in terms of development.
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 have been searching for quite a while and cannot seem to find a working DHCP Client implementation example in C#. I am brand spankin' new to Network Programming, but am doing some research that requires me to write a manual DHCP client and to implement Auto-IP if there is no DHCP server.
Any code examples, or names of built-in C# classes that can help me with this would be appreciated.
You are not going to find that; the reason is “security”.
Regular net APIs allow you to handle Level-3 and up but
a DHCP client must be able to handle Level-2; i.e. for broadcasting to MAC FF:FF:FF:FF:FF:FF on DHCP DISCOVERY packets
For security reasons Microsoft today does not allow you to craft Ethernet packages at such a low level.
You cannot use raw sockets; read here why:
Limitations on Raw Sockets
http://msdn.microsoft.com/en-us/library/ms740548(v=vs.85).aspx
You can install the pccap driver on your pc and use that apI to send raw packets
Im sorry if this been asked before, but couldnt find anything about this particular matter.
I try to find out with which of my own ip's my computer use to connect to a remote ip.
I use some kind of socket setup both ways etc, and im sending my ip (and other stuff with xml) to another server so it knows how to contact me.
But how do i figure out which ip i should send to it?
I have the servers ip or host name, but trying with
Dns.GetHostEntry("host").AddressList
But that only gives me the ip of the remote host and not how my computer reach it.
Is my question solveable at all or is this just wishful thinking?
Can you have the remote host capture that data? That end would surely have it.
If you're using UDP then this is exactly what the STUN protocol was designed for. STUN is used in VOIP applications (among other P2P systems) to be able to tell what a specific connection looks like on the internet.
One very reliable .NET implementation that implements STUN is included in the Lumisoft.NET library (source code available here). I've used it myself for to satisfy this specific task for applications ranging from VOIP to P2P VPN alternatives. It is very easy to use and is standards compliant.
NOTE: I am NOT in any way affiliated with Lumisoft, I've merely used their library in several different applications
Ok, quick update that wont help anyone except myself.
But.
Found out that i can send hostname instead of actual ip, will work for now and most cases, and let the DNS do what its suppose to do :)