Delphi
--
Questions
--
Followers
Top Experts
Right now, the clients connect to a server with TCP, the server send back the packets sent from one client to the other.
The problem is since TCP check the packets sent, making it slower, is not a suitable for Audio/Video streaming.
The only possible way I can thing of right now is to send the streaming through a faster protocol like UDP.
The problem is that UDP works faster yes but since it's connectionless, the server cannot send the packets back since we don't have any connection with the clients as we had with TCP.
Adding to the clients a TUdpServer won't help because of the NAT issue.
There must be a way since IM, ICQ and Skype aren't after all real P2P applications. The two first send data to and from the clients using a server, Skype use any user that is not behind a NAT as a server called as "SuperNode".
So in any configurations, no client is connected to another directly.
One the other hand, there is no way those applications use a TCP protocol, as mentioned, no matter your bandwidth, you can barely make it with audio streaming but video won't work properly.
Does anyone have experience with this kind of development?
Thanks
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
However, for some, they allow a fallback which is
client creates a TCP connection to the server, (optionally passing any port info for their UDP server)
if the server is unable to connect to the client's UDP server, it is assumed they do not have 1 open.
Client can still send data via UDP _up_ to the server
but the server will only send data back via TCP.
I don't think it is a big ask to have someone open a UDP port
Thanks for your reply.
It's not a question of big ask. Most of regular users behind routers don't know how to configure and redirect connections to a specific port.
Since this application is meant to be distributed among regular users, I can't see a way to describe them how to configure their routers; especially when each router has a different configuration interface.
I heard about the UDP hole punching and I have read the article. I 'm not sure I could understand the algorithm described there.
Are you familiar with this technique? If yes, how it is implemented with Delphi?
Thanks
That's almost word for word what the setups say :-D
"Please configure your firewall to allow UDP port xxxx
Since the actual steps to do this vary for each router, you will need to consult your router's user manual..."
or something like that :-D
To be honest, I've never written a UDP hole punching routine. I understand the logic, and how to do it with Indy and the bindings, but do not have anything written, or a tested sample for you.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
I tried the following but it doesn't work.
"A" connect with UDP to the server.
I get the temp port opened by "A" and send it.
"A" open his own UDP server with the temp port.
"B" get also the port and Ip address of "A" and send a packet  to "A" but nothing arrives.
http://www.heise-online.co.uk/security/How-Skype-Co-get-round-firewalls--/features/82481
and also the "Full Cone Nat"
http://en.wikipedia.org/wiki/Network_address_translation#Different_types_of_NAT
A tries to send a UDP directly to B
B rejects it
a little alter on, B sends a message to A.
A sees this, and thinks it is the response it is waiting for  so it lets it in (because A tried to send to B before)
Does that make things a little clearer?
The reason these go through another server is only so that A and B can find out each other's Ip address and port.
It also helps to ensure it happens in the desired order

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
I already tried that and I think the problem is because both computers I'm testing are behind a CheckPoint router. CheckPoint assign a random port for every session so for example if in the first session A connect to the server at port 31002, B open a session to A with that port to fool its own router, when B try to connect to A, B's port is already different from the first one i.e. 31003 so A's firewall doesn't recognize that connection.
@MerijnB
Messing with UPnP is the last thing I would go for. Try finding UPnp devices.
Try this link http://noeld.com/dl.asp?path=upnptest.zip
It didn't find any device on my computer.
I should maybe stick to Skype trick. Skype try to punch with the technique described, if a computer goes out every time with a different port, Skype continue punching hopping a previous port will come up again and use this port.
I tried to find some examples on video streaming and I found none beside streaming directly to another computer that is not behind a NAT or having port mapping.
I need some kind of protocol that is not connectionless but that doesn't check the packets delivery, TCP is not fast enough to send real time streaming. UDP is fast but connectionless. Dam...
Delphi
--
Questions
--
Followers
Top Experts
Delphi is the most powerful Object Pascal IDE and component library for cross-platform Native App Development with flexible Cloud services and broad IoT connectivity. It provides powerful VCL controls for Windows 10 and enables FMX development for Windows, Mac and Mobile. Delphi is your choice for ultrafast Enterprise Strong Developmentâ„¢. Look for increased memory for large projects, extended multi-monitor support, improved Object Inspector and much more. Delphi is 5x faster for development and deployment across multiple desktop, mobile, cloud and database platforms including 32-bit and 64-bit Windows 10.