hole-punching

Problems with TCP hole punching

你离开我真会死。 提交于 2021-02-07 05:47:30
问题 I've tried to write a basic TCP hole puncher for a firewall in Python 3 using the principles outlined in this article. I'm having trouble getting anything to connect, though. Here is the code: #!/usr/bin/python3 import sys import socket import _thread as thread def client(): c = socket.socket() c.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) c.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) c.bind((socket.gethostbyname(socket.gethostname()), int(sys.argv[3]))) while(c.connect_ex

How to make 2 clients connect each other directly, after having both connected a meeting-point server?

不打扰是莪最后的温柔 提交于 2021-01-21 04:32:50
问题 I'm writing a toy meeting-point/relay server listening on port 5555 for two clients "A" and "B". It works like this: every byte received by the server from the firstly-connected client A will be sent to the secondly-connected client B, even if A and B don't know their respective IP : A -----------> server <----------- B # they both connect the server first A --"hello"--> server # A sends a message to server server --"hello"--> B # the server sends the message to B This code is currently

udp packet loss and recovery

妖精的绣舞 提交于 2020-02-01 08:53:05
问题 I am working on both udp/tcp based P2P for file and real time video streaming application.the application will be developed for both Linux and windows platform using c++. We are using ICE(TCP/UDP hole punching) to implement the P2P. while TCP ensure the packet loss but for UDP I need a decent approach to make sure packet must be delivered to the other peer. I wanted to know the algorithm or technique to do this. Is there any free thord party tool/libraries to do. Any link and suggestion will

UDP Hole Punching help

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-22 12:50:09
问题 I'm trying to add networking over the internet to my game, using Peer to Peer. I have already implemented a LAN only version, which uses .NET's peer to peer classes to connect within the local network. I realized I need to use UDP hole punching in order to establish a connection to other clients that are behind a firewall. This is how I have started to implement it: The server is a HTTP server using very simple PHP scripts to get the job done. register name on server, sending the private ip

How do I do TCP hole punching?

雨燕双飞 提交于 2020-01-11 17:08:36
问题 Question is below. Here is my current test code which did not succeed. static void Main(string[] args) { if (args.Count() != 3) { Console.WriteLine("Bad args"); } var ep = new IPEndPoint(IPAddress.Parse(args[0]), int.Parse(args[1])); var lp = new IPEndPoint(IPAddress.Any, int.Parse(args[2])); var s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); s.Bind(lp); var c = new Socket

UDP Hole Punching Algorithm

心已入冬 提交于 2019-12-29 18:43:11
问题 Can anyone give an example of a UDP Hole Punching ? Actually, I want to write a chat program with which people can chat when they know each other's IP. But both the machines will be behind a firewalled router. So, I need to punch a hole in order to communicate. I would like a function such that on calling the function, a hole would have been punched and future communications would move on easily - if that's not too much to ask for :) 回答1: Short Answer: it can't be done reliably. Long Answer:

Send files after udp hole punching

佐手、 提交于 2019-12-23 02:46:28
问题 I have 2 computers behind NAT. To make a connection between them I use an UDP hole punching protocol. It works. Now I want to send files by this tunnel. I guess I must have a TCP tunnel between those 2 computers. Both firewall DENY all TCP trafic. Is it possible ? If not, is there any other solution ? How does Skype sends files by this UDP Tunnel ? 回答1: You can use UDT protocol for file transfer after it gets hole punched. UDT is made on top of UDP. It has the reliability of TCP and fastness

How to simulate different NAT behaviours

情到浓时终转凉″ 提交于 2019-12-20 10:44:11
问题 I am working on Holepunching using UDP and UDT. For the final testing I need to test the application on different NAT types (Symmetric,full cone,restricted cone, port restricted NATs). Is there any method I can simulate these? What I expect here is some kind of virtual-Box setup. Can I use PC as a router so that I can configure according to my needs? In general how do we test applications for different network conditions? 回答1: I think you already answered your own question, use VirtualBox (or

UDP Hole Punching (c++/winsock)

天大地大妈咪最大 提交于 2019-12-13 01:26:57
问题 stackoverflow users! I have an app that has to deal with p2p, and that's how I get to UDP Hole punching. But I ran into troubles with implementation. Hope, you can give me some tips. I've got server, which works perfect and introduces clients to eachother, but clients can't connect probably because of my small exp working with sockets. So, client algo is: Create udp socket ( socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); ) Send message to server via sendto function Use recvfrom locker function to

best peer to peer technique for mobile network

旧街凉风 提交于 2019-12-12 03:44:51
问题 I deal with design of peer to peer communication between mobile unit and user phone. Mobile unit is targeted into cars, so it is possible that it could be connected to many various ISPs. It can be also expected that the clients will be often disconnects. I need to find best solution in NAT traversal techniques, which is applicable in conditions of mobile network, which are little different than the usual networks as WiFi. I search for often used techniques and found a many different practices