500: UDP theoretical question

Posted on 2006-03-31
Last Modified: 2010-04-11
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
Question by:smotbd
    LVL 18

    Accepted Solution

    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.

    Assisted Solution

    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.

    LVL 18

    Expert Comment

    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.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Suggested Solutions

    Network ports are the threads that hold network communication together. They are an essential part of networking that can be easily ignore or misunderstood, my goals is to show those who don't have a strong network foundation how network ports opera…
    Join Greg Farro and Ethan Banks from Packet Pushers ( and Greg Ross from Paessler ( for a discussion about smart network …
    Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
    After creating this article (, I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now