UDP vs TCP

Hi,
i want to create a very easy multiplayer shooter. At first view, it seems to be easy to program but:
Positions of the players are transfered frequently by UDP. It is not fatal if one UDP package is missing ( the next one will come within milliseconds).
But what if a player shoots? If the UDP package which transfers the shoot is missing, it would be fatal.
Is it posible to use TCP for shots? Or is UDP still OK? Or do i have to use that shitty, hard reliable UDP?
By the way, what's the difference of TCP and reliable UDP. why is TCP still used although there is a faster RUDP?
thx,
chr

Fachmann wrote:
Is it posible to use TCP for shots? Or is UDP still OK? Or do i have to use that shitty, hard reliable UDP?You could use UDP, but define your protocol to require a acknowledgement if the package is important (i.e. it contains a "shoot" information). Then you could retransmit if the package if you don't get a response soon enough.
In fact you'd be implementing a (partially) reliable protocol on top of UDP.
You could use a TCP connection for this. I don't know if it would be easier, 'though.
By the way, what's the difference of TCP and reliable UDP. why is TCP still used although there is a faster RUDP? I ask differently: What were the reasons RUDP was developed? I've never seen it in actual use and it seems to be a niche protocol.

Similar Messages

  • How to forward UDP on TCP?

    Hey everyone,
    I'm behind a firewall that blocks all UDP (torrents, games...) requests.
    I usually ssh to my server and forward all the trafic to it using a transparent
    proxy application (sshuttle). I saw that openvpn handles UDP as well (sshuttle doesn't).
    I read the documentation of openvpn but I didn't understand which flags to use
    and which not to. Actually I suck at networking and I'm not even sure if the title of the question
    is correct (would explain why I couldn't find anything on the forum/online).
    So could you please help me out? and sorry for any mistake I did.
    Thanks

    OpenVPN, has two operating mode: tun and tap. Tun just tunnels IP traffic (UDP and TCP), while Tap acts like a real ethernet cable. To achieve this, OpenVPN has to make a network connection with the remote server. To do so, you have two choices again: UDP and TCP.
    What you want is probably tun+tcp, which will make the UDP traffic going into OpenVPN to be transmitted over the TCP connection and go out of the server as UDP.
    The config options are
    proto tcp
    dev tap
    The wiki entry (https://wiki.archlinux.org/index.php/Op … ll_OpenVPN) should work fine for you. Just don't forget to use "proto tcp" in both server and client configs. The default setup should be perfectly fine for you.
    As noted by brain0, tunelling UDP over TCP will cause higher latency on UDP. It should work fine for torrents, but the latency will be something 1.5x the latency from you and the server  + the latency between the server and the final destination of the UDP traffic. Gaming on that might be painful.

  • UDP and TCP ports

    Hi:
    I have a question. As we know, scanning TCP ports is a lot eaiser than UDP ports because active UDP ports don't respond and there are other reasons as well.
    try{
    Socket soc= new Scoket(address, portnumber);
    catch(Throwable e){ System.out.println(e)}
    look at the code above, it can only tell you active TCP ports for the Throwable e tells you nothing about UDP ports. An active UDP port doesn' respond to the connection call "soc". Therefore it will throw an exception(connection refused) after trying to connect an active UDP port. This exception is just like those of closed TCP ports.
    What i am saying is that active UDP ports will be treated the same as closed TCP ports. They are hidden in closed TCP ports. How do i sift them out? Any solutions?

    I am basically trying to determine how many UDP and TCP ports on a machine are open. Open TCP ports are easy to see. But UDP ports are tricky. Can you please tell me more in detail using a datagram socket?

  • BEFW11S4 UDP AND TCP PORT opening

    How do i open UDP AND TCP ports specifically TCP ports: 80, 6667, 28910, 29900, 29920
    UDP ports: 4321, 27900 Its for a networkable game i need to open these ports to play it.

    Ok But when i try disabling the numbers in the forwarding field i run out of spaces in the field to be able to disable them Is there an advanced firewall settings that i dont know about? I put in all of the range forwarding and put the range forwarding start for example 80 originally (TCP ports: 80, 6667, 28910, 29900, 29920
    UDP ports: 4321, 27900) The ones i try to disable i run out of fields to disable them in the forwarding for example there are 10 slots for disabling and Im trying to disable them on two numbers 192.168.1.101. and 192.168.1.100 So i need to disable them for both ip numbers I got 10 fields to enter it into them and 10 x 2 is more than the numbers..... You get me?? and on top of that i dont know if what i did was enough Linksys doesnt want to help me without paying 30 dollars so im just thinking i should buy a new router....... i mean they charge 39 dollars for a new router and they want me to pay 39 dollars for tech support it just doesnt make any sense........

  • UDP vs TCP (hands-on experience required)

    Dearest colleagues,
    I've done a few hours of research learning what I can about TCP vs UDP. I could still use some input from those of you who have used both in real-world, scaleable, distributed, commercial, and successful projects.
    I have a new position at a new company. My part of this project consists of 3 types of distributed Java server programs: desktop client, data server, and controller server. Thousands of desktop clients will be periodically transferring "megs" of data to several data servers. The (singular) controller will persist metadata into a database, and also coordinate data transfer between the desktop clients and the data servers.
    TCP seems appropriate for all "control" and metadata communications between all these components. Everyone talks to the controller for everything, except for the periodic transfer of the "actual" data. The desktop clients send that data directly to the appropriate data server using either UDP or TCP.
    One key project requirement is the ability to provide network throttling control, so as not to saturate the client's LAN or WAN. This product mustn't disrupt the client's real-time network data (like VoiP and video conferencing). I expect the controller server to manage this.
    Someone with more seniority than me at this company has suggested TFTP (which uses UDP) as the best protocol for the data transfer protocol. This person also claims that UDP allows larger packet sizes and less protocol overhead, resulting in greater data transfer rates than TCP.
    I have a number of concerns and questions:
    1) Can't the packet sizes be set for both UDP and TCP? If so, can't one equal both (in terms of average overhead) just by adjusting the packet sizes?
    2) I realize that one needs to accomodate UDP droppage in order to compare throughput with TCP. In a LAN environment is it reasonable to assume that droppage would be minimal or zero? )Otherwise wouldn't it be a LAN problem someone would be fixing?)
    3) If #2 above allows me to assume minimal UDP droppage, does the underlying packet protocol overhead difference give UDP a substantial throughput advantage? If so, how much (roughly)?
    4) I believe UDP packets are treated as "high priority" but "low reliability". For my application, doesn't that mean that UDP is more likely to cause problems by competing for VoiP and VidCon bandwith?
    5) What about trying to write my servers to allow for either UDP or TCP to be
    used for data transfer? If you have done this, would you recommend for or against it? Why?
    6) If you had to recommend just one book for me for right now (given this project), which would it be:
    6a) Java Distributed Computing (O'Reilly) by Jim Farley
    6b) Internetworking with TCP/IP by Doug Comer's
    6c) Unix Network Programming by Richard Stevens
    Being the New Kid on the Block at this company, I need to know all I can as I navigate the politics with this more senior person. I'm no newbie - I've been programming professionally for 27 years, the last 6 in Java including networking, sockets, JDBC, etc.
    Thank you very much for your assistance.

    Dearest colleagues,
    I've done a few hours of research learning what I can
    about TCP vs UDP. I could still use some input from
    those of you who have used both in real-world,
    scaleable, distributed, commercial, and successful
    projects.
    I have a new position at a new company. My part of
    this project consists of 3 types of distributed Java
    server programs: desktop client, data server, and
    controller server. Thousands of desktop clients will
    be periodically transferring "megs" of data to
    several data servers. The (singular) controller will
    persist metadata into a database, and also coordinate
    data transfer between the desktop clients and the
    data servers.
    TCP seems appropriate for all "control" and metadata
    communications between all these components.
    Everyone talks to the controller for everything,
    , except for the periodic transfer of the "actual"
    data. The desktop clients send that data directly to
    the appropriate data server using either UDP or TCP.Key feature of TCP is connection orianted and reliablity. If you need long sessions with high reliability TCP is the way to go.
    (Long sessions means the client do multiple transaction through same session)
    But reliablity of TCP comes at a cost. (Less bandwith efficiency) but of course if you need to transfer data I say TCP is better.
    But if you want your clients need to work in unreliable network links (Onse that breakes down often) TCP might cause problems since you have to re establish the connection every time there is a problem.
    Also if the sessions are short then UDP is better becouse if you Use TCP for very short sessions Connection establishment and closing can take more time that the actual data transfer.
    But if you use UDP you must deal with the unreliability.
    One key project requirement is the ability to provide
    network throttling control, so as not to saturate the
    client's LAN or WAN. This product mustn't disrupt
    the client's real-time network data (like VoiP and
    video conferencing). I expect the controller server
    to manage this.It is true that TCP add more owerhead than UDP but in most cases compaired to the amount of data you transfer through network that is nothing.
    Key to save the bandwith is to designe a efficint communication protocol which minimize the amount of data that you have to transfer.
    Also you can Implement input/output streams which can limit the number of bytes that can be written or read through them. (Even though that got nothing to do with networking that will give you full control over the bandwidth usage by the programs)
    Someone with more seniority than me at this company
    has suggested TFTP (which uses UDP) as the best
    protocol for the data transfer protocol. This person
    also claims that UDP allows larger packet sizes and
    less protocol overhead, resulting in greater data
    transfer rates than TCP.TFTP is good for transfering small files through networrks since there is less overhead but when it comes to large amounts of data there is no much difference.
    But TFTP have a advantage over ureliable networks.
    (If the networks fails TCP connection fails, but in UDP a network faliour is just a loss of several datagrams which the programs anyways should be able to handle)
    I have a number of concerns and questions:
    1) Can't the packet sizes be set for both UDP and
    TCP? If so, can't one equal both (in terms of
    average overhead) just by adjusting the packet
    sizes?In tcp packet size is not a big issue since data are transfered through stream. Once the streams are open you can keep them opena as long as you want and send as many bytes as you want.
    2) I realize that one needs to accomodate UDP
    droppage in order to compare throughput with TCP. In
    a LAN environment is it reasonable to assume that
    droppage would be minimal or zero? )Otherwise
    wouldn't it be a LAN problem someone would be
    fixing?)Even though UPD is said to be unreliable if the programs are written well. In a LAN UDP is almost as areliable as TCP(This is depend on the reliability of LAN)
    Thats why it says when you write UDP applications you must test them in slow unreliable Wan links.
    3) If #2 above allows me to assume minimal UDP
    droppage, does the underlying packet protocol
    overhead difference give UDP a substantial throughput
    advantage? If so, how much (roughly)?It depends
    Ex:-
    Lts assume UDB header is 25 bytes and TCP heade is 50 for simplicity
    If your data size is 10 byte.
    lets say UDP adds overhead of 5 bytes
    now the efficiency is 10/(10+25) = 0.38
    If TCP adds 10 overhead bytes
    now the efficiency is 10/(10+50) = 0.16
    lets doa the same calculation for 1000 bytes
    UDP
    1000/(1000 + 25) = 0.97
    TCP
    1000/(1000+ 50) = 0.95
    So it depends on your application and data volume
    4) I believe UDP packets are treated as "high
    priority" but "low reliability". For my application,
    doesn't that mean that UDP is more likely to cause
    problems by competing for VoiP and VidCon bandwith?No Priority is set on IP level so it can be applied to both TCP and UDP
    5) What about trying to write my servers to allow
    for either UDP or TCP to be
    used for data transfer? If you have done this, would
    you recommend for or against it? Why?For data transfer I recomend TCP becouse reliability is important.
    If you use UDP you have to handle reliability (Lots of programming)
    6) If you had to recommend just one book for me for
    right now (given this project), which would it be:
    6a) Java Distributed Computing (O'Reilly) by Jim
    Farley
    6b) Internetworking with TCP/IP by Doug Comer's
    6c) Unix Network Programming by Richard Stevens
    Being the New Kid on the Block at this company, I
    need to know all I can as I navigate the politics
    with this more senior person. I'm no newbie - I've
    been programming professionally for 27 years, the
    last 6 in Java including networking, sockets, JDBC,
    etc.
    Thank you very much for your assistance.

  • Does RTP rely on UDP or TCP?

    Hi,
    As the JMF document suggests, RTP relys on UDP. But when I open an RTP session in JMStudio, and deliberately set the port to 80, an error throws out saying unable to create session manager. Since I'm running an http service on 80, my immediate guess is that RTP uses TCP too. Or is it?
    Would somebody please explain how JMF's RTP works? how it establishes connection, etc.? Or please point me to the direction to find the answers.
    Thanks
    LunaPapa

    The following links will be useful.
    1) http://java.sun.com/products/java-media/jmf/2.1.1/solutions/index.html
    2) http://java.sun.com/products/java-media/jmf/2.1.1/guide/JMFTOC.html
    To add, UDP is widely used protocol for Real-Time Transfer in JMF
    http://java.sun.com/products/java-media/jmf/2.1.1/guide/JMFArchitecture.html#112612
    At the above url, you will get the answers for, how JMF works, etc..
    Hope most of your doubts should be resolved here.

  • How can I open both UDP and TCP ports

    Hi,
    How can i open both tcp and UDP ports for an IP in Cisco ASA?
    Regards
    Ejaz

    Are you referring to port opening in Cisco ASA to permit certain traffic? I believe the following document should help.
    http://www.cisco.com/en/US/docs/security/asa/asa82/configuration/guide/acl_overview.html
    Adding a Standard Access List
    hostname(config)# access-list access_list_name standard {deny | permit} {any | ip_address mask}
    Example:
    hostname(config)# access-list OSPF standard permit 192.168.1.0 255.255.255.0
    http://www.cisco.com/en/US/docs/security/asa/asa82/configuration/guide/acl_standard.html
    Adding an Extended Access List
    access-list access_list_name [line line_number] [extended] {deny | permit} protocol source_address mask [operator port] dest_address mask [operator port | icmp_type] [inactive]
    Example:
    hostname(config)# access-list ACL_IN extended permit ip any any
    http://www.cisco.com/en/US/docs/security/asa/asa82/configuration/guide/acl_extended.html
    Hope this will help.

  • Maximum # of UDP and TCP port Mappings

    Does anyone know for sure the total number of port mappings you can create on the airport extreme?
    Thanks

    Ok But when i try disabling the numbers in the forwarding field i run out of spaces in the field to be able to disable them Is there an advanced firewall settings that i dont know about? I put in all of the range forwarding and put the range forwarding start for example 80 originally (TCP ports: 80, 6667, 28910, 29900, 29920
    UDP ports: 4321, 27900) The ones i try to disable i run out of fields to disable them in the forwarding for example there are 10 slots for disabling and Im trying to disable them on two numbers 192.168.1.101. and 192.168.1.100 So i need to disable them for both ip numbers I got 10 fields to enter it into them and 10 x 2 is more than the numbers..... You get me?? and on top of that i dont know if what i did was enough Linksys doesnt want to help me without paying 30 dollars so im just thinking i should buy a new router....... i mean they charge 39 dollars for a new router and they want me to pay 39 dollars for tech support it just doesnt make any sense........

  • UDP and TCP

    People told me that data might go lost if I use UDP Protocol, so I have to use TCP.
    But I am quite confused cause I read that the data link layer will make sure the data transfers correctly, so I suppose no data would be lost even if I use UDP cause it's based on the link layer.
    Can someone solve my puzzle?

    But the data link already take care of this. So no
    packets should be lost.No.

  • Combining UDP and TCP connections

    I am trying to build a simple client -server app, where multiple client sends price quotes to a server and the server does some analysis on these numbers and spits it back out to all the clients every 5 seconds or so. Before I start, I want to make sure I am thinking about it correctly. I was thinking that I could have on each client a UDP connection and a TCP connection, the TCP connection would be used to send the quotes to the server. This way I have a live connection and confirmed packet reception from client to server.
    The UDP would be used for when the server sends back out the quotes to all the clients, since the server is just sending out back certain ones (the best quotes that is) to all the clients. Does that seem like a reasonable design?

    The only reason is because the server should be sending out it's information via datagrams because it wants to send the same message to all the clients. So in my point of view it looks like it would be more efficient to send out one datagram, broadcasted instead of going through each client and sending the same thing, especially when I'm trying to send an update every 5 seconds or so.

  • Sending microphone sound with UDP or TCP

    Hello everybody
    I want to send my voice over the internet to another java application. (It's like a voice chat)
    Does somebody knows how i can implement this function ?
    Does somebody has an example ?
    greetz
    Kristof

    See JMF Solutions page. AVTransmitter sample is the your way with JMF.
    It uses UDP connection.
    Be sure you can process your voice stream from JMF on your "anoher application". If there are no JMF or another handle for JMF stream you won't be able to decode it.

  • Entering UDP and TCP numbers

    ^^^ Just need help with that, its for my PS3, i called Sony after getting DNS errors(80710102) and they told me i need to enter the numbers they gave me, i just want to know were to pit them... And my router is a WRT54G btw...
    Message Edited by Gran_Turismo on 06-28-2007 10:39 PM

    from the computer wired to the router , access the web interface of the router using http://192.168.1.1 .. the default password is "admin"...once on the ui  go to the "applications and gaming" tab and click on the "port trigerring" subtab .. enter the port numbers on this page ..

  • How do I create a digital signature on a TCP or a UDP flow?

    I am trying to convert samples of a voice signal, which is intercepted from the microphone, into fixed length digital signature bytes (using Hash, or) and attach these fixed length bytes to a communication session between two terminals (UDP or TCP "HTTP"). The other receving end should be able to identify the person at the sending side.
    Any thoughts how I could do this?
    Any help is most appreciated.
    Sam

    Sam,
    If you have the Sound and Vibration toolkit it may make some things easier for you regarding the voice-recording aspect, but if you aren't recording and playing back the actual sounds, just using this for detection and digital signatures, you shouldn't need to worry about this.
    1. For this you are going to be doing some form of Analog Input.  Then you will be storing this data to a file.  There are examples for both of these aspects in the NI Example Finder from within LabVIEW.
    2. If you are going to be doing the FFT, there is a VI under the Mathematics Palette that performs this operation.  Again you can use the same example for saving data to the file.
    3. You would need to figure out what needs to be done to create a digital signature for this.  There may be something in the Sound and Vibration toolkit for this, but I do not know.
    4. For the UDP or TCP transfers, there are several examples for doing this and they cover how to create the connection and transfer / receive data.  These too are in the NI Example Finder
    5. This goes back to number 4, this would indeed be a separate program, but everything else would just be one project and one program.  
    6. This would depend on how the ID was created in step 3, again whether you do the algorithm on yourself or not.  For comparing to the table, you would use a Search Array and some comparison functions, all depending on how you stored the data initially.
    7. Graphs are all available on your Front Panel of your VIs and you would just wire up the data that you'd like and have it displayed on the graph.
    There will not be an example for everything that you are wanting to do.  The examples are meant to help you get started.  Have you used LabVIEW before?  I would recommend doing the 3 Hour LabVIEW Introduction Course to help you get started.  This will cover some of the basic concepts that you will need to know in order to create your application.
    Unfortunately I cannot write the code for you, only guide and direct you.  LabVIEW is a programming language and does require the user to lay out and create their own program.  You will not be able to just find three or four pre-built code-snippets and connect them together to get your appliction working the way you want it.  You will need to develop the applications yourself.
    Regards,
    Jared Boothe
    Staff Hardware Engineer
    National Instruments

  • Measuring performance tcp udp connection using java

    ho
    find t answers for these questions ..
    1. Is it possible to set some upper cut off for the data rate or transmission rate in TCP or UDP ?
    2. IF true, get t source code for t same ?
    3. is it possible to measure t data rate of a TCP or UDP connection ?
    4. get t compl source code for broadcasting using java ?
    sry im learning to use java sry if my questions are rookie and absurd . .
    pl bear wit me . .
    thank u in advance . .
    bye bye

    hi ebj and kayaman ,
    thanks for the reply for my first question . .
    "No, but you can limit the receive window which can have a similar effect."
    my second question was ...
    can help me out by giving the java code for the first question`s solution ?
    and my third question ...
    Is it possible to measure the throughput / transmission rate in which the udp or tcp transfer is taking place ??
    i think i ve made myself clear to you guys ..

  • CUSP changing transport to TCP from UDP in VIA headers

    How does CUSP decide when to use TCP vs UDP when forwarding INVITES to CUCM when both UDP and TCP are configured on the Network Listen Ports?  We have two different calls flows coming from our SBC to CUSP.  Both INVITES have UDP as the transport.  CUSP forwards one call flow to CUCM with TCP as the transport and the other as UDP. Is there something unique to the first INVITE below that would signal CUSP to use TCP?
    Invite from SBC that CUSP adds TCP as the transport in the VIA header towards CUCM
    40:13.979 On [2:245]10.XXX.XXX.XXX:5060 sent to 10.240.XXX.X:5060
    INVITE sip:XXXXXXXXXX@cusplab:5060 SIP/2.0
    Via: SIP/2.0/UDP 10.XXX.XXX.XXX:5060;branch=z9hG4bKm2u8f32038e12is8p3v1.1
    From: "Test User 1" <sip:[email protected]:5060>;tag=SDi82if02-13984769016573306_c2b04.1.2.1378274120440.0_1121221_2220804
    To: <sip:[email protected]>
    Call-ID: SDi82if02-2664bc8b12611edfd30a0552529e0b90-cggngq0
    CSeq: 2 INVITE
    Session-Expires: 1800
    Min-SE: 1800
    Allow-Events: telephone-event
    Cisco-Guid: 3327242752-0000065536-0000181788-1640976394
    Acme-Call-ID: 9AA7C362-1BBC11E3-81019B0F-C8BF5371
    Timestamp: 1379084661
    Expires: 180
    Supported: timer,replaces,sdp-anat
    P-Asserted-Identity: "Test User 1" <sip:[email protected]>
    Allow: INVITE,ACK,CANCEL,BYE,INFO,PRACK
    User-Agent: Cisco-SIPGateway/IOS-12.x
    Max-Forwards: 59
    Contact: <sip:10.XXX.XXX.XXX:5060;transport=udp>
    Content-Length: 325
    Content-Disposition: session; handling=required
    Content-Type: application/sdp
    v=0
    o=CiscoSystemsSIP-GW-UserAgent 2487 3295 IN IP4 10.XXX.XXX.XXX
    s=SIP Call
    c=IN IP4 10.XXX.XXX.XXX
    t=0 0
    m=audio 55178 RTP/AVP 18 100 101
    c=IN IP4 10.XXX.XXX.XXX
    a=rtpmap:18 G729/8000
    a=fmtp:18 annexb=no
    a=rtpmap:100 X-NSE/8000
    a=fmtp:100 192-194
    a=rtpmap:101 telephone-event/8000
    a=fmtp:101 0-16
    a=ptime:20
    INVITE from SBC that CUSP adds UDP as the transport in the VIA header
    15:14.881 On [2:245]10.XXX.XXX.XXX:5060 sent to 10.240.XXX.X:5060
    INVITE sip:XXXXXXXXXX@cusplab:5060 SIP/2.0
    Via: SIP/2.0/UDP 10.XXX.XXX.XXX:5060;branch=z9hG4bKg04f5a105040ei4764o1.1
    From: "Test User 2" <sip:[email protected]:5060>;tag=SDdeh1202-125657148404519E-4_c2b09.2.1.1376631876821.0_2507555_4963634
    To: <sip:[email protected]>
    Call-ID: SDdeh1202-c8199578035cb96793dbe0fb6ef98d84-cggjoq2
    CSeq: 2 INVITE
    P-Asserted-Identity: "WIRELESS CALLER" <sip:[email protected]:5060>
    Allow: INVITE,ACK,CANCEL,BYE,INFO,PRACK
    Accept: application/sdp, application/isup, application/dtmf, application/dtmf-relay,  multipart/mixed
    Max-Forwards: 64
    Contact: <sip:10.XXX.XXX.XXX:5060;transport=udp>
    Content-Length: 266
    Content-Disposition: session; handling=required
    Content-Type: application/sdp
    v=0
    o=Sonus_UAC 12183 15514 IN IP4 10.XXX.XXX.XXX
    s=SIP Media Capabilities
    c=IN IP4 10.XXX.XXX.XXX
    t=0 0
    m=audio 55134 RTP/AVP 18 0 100
    a=rtpmap:18 G729/8000
    a=rtpmap:0 PCMU/8000
    a=rtpmap:100 telephone-event/8000
    a=fmtp:100 0-15
    a=sendrecv
    a=maxptime:30

    Hi. Did you ever find out the reason and a solution to this problem. I am having the same issue where CUSP decides to change the transport type to TCP (from UDP) when talking to CUCM on certain invites from Acme SBC. On some invites from the same Acme SBC, CUSP doesn't change the transport type and leaves it as UDP.
    Thank you.

Maybe you are looking for