500: UDP theoretical question

Hi all,

I have heard that UDP is conectionless and that a connection is only made when sending data.
However, is it actually possible to create a connection with an UDP socket and hold that connection even if no data is to be sent for a little while i.e connect, wait few seconds then send data....?
The reason I ask is: I want PC1 to connect to PC2 and then after a few seconds, have PC2 to stream video to PC1.
Problem is: I can't make PC1 connect to PC2 straight off since PC2 has a non-routable ip address. With TCP, this is simple to achieve- make tcp socket connection from PC2 to PC1 then send data from PC2 to PC1. BUT can it be implemented with UDP????

Also, can a TCP client connect to UDP or does e.g to have a tcp connection then you need tcp socket on server side and client side?

Many thanks
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TCP and UDP are two entirely different protocols... that doesn't mean you can't use both, but it's like me speaking in French to you, then trying to start a new conversation in Greek. Sure, both sides can understand both, but you can't use one to work with the other. So you'd end up with a TCP socket and a UDP socket.

With UDP, you'd have to keep sending dummy packets to have a "connection". Remember that UDP cannot keep track of your state.

So it may not really be worth it trying to take that approach.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
To communicate using UDP there was no need to establish a connection prior to the data transmission.

Insted you can send a UDP packet with requiest msg from PC1 to PC2. Here PC2 has to listen on the UDP port for incomming request.
the PC2 can start sending data.

The other way is you can TCP to establish a connection from PC1 to PC2, the PC2 can send date to PC1.
but you cant use UDP on one end and TCP on the other end.

One other major thing.... there's not going to necessarily be an exact timeframe that you'll be able to pull off because of normal things over the internet.

If you ever look into how data flows in TCP/IP and compare it against UDP, you'll actually find it not to be very feasible to try to do that with UDP since you'd have to write a program that would keep track of all of this... it's almost like trying to reinvent TCP/IP.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.