Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have just installed Apache web server on my computer. I have managed to use it locally (I can open index.php from my computer using my web browser). But I would like to make my web site available publicly. I found out that for that I need to open port 80. I started to do it and now I have to specify to which protocol I need to apply these rules (TCP or UDP). Can anybody, pleas, help me?

share|improve this question
add comment

2 Answers

up vote 21 down vote accepted

Web servers work with the HTTP (and HTTPS) protocol which is TCP based.

As a general rule, if people neglect to specify whether they mean TCP/UDP/SomethingElse then they probably mean TCP.

share|improve this answer
1  
While your answer is correct from a practical point of view, you might want to note that the HTTP specification actually doesn't specify which transport protocol has to be used. So HTTP over UDP or HTTP over SCTP is as valid as HTTP over TCP, which is commonly used. –  joschi Feb 26 '10 at 10:45
    
Interesting thought. UDP could make small requests (where the request and response each fit into a packet or two like many AJAX requests, small gifs and css files, ...) quicker by reducing latency, possibly making more difference than keep-alive connections. The presence of unreliability in the network could quickly kill the bonus though, and browsers would have to deal with the added complication of re-requesting lost packets. I wonder if anyone has tried it... –  David Spillett Feb 26 '10 at 11:19
3  
No, HTTP over UDP is not as valid as HTTP over TCP. From RFC2616 "HTTP only presumes a reliable transport; any protocol that provides such guarantees can be used" UDP does not presume a reliable transport. –  Daniel Papasian Mar 4 '10 at 9:18
    
@Daniel: Aye, that is why the browser (and server) would need to be aware of and account for packet loss in my thought-dump (essentially reinventing part of what TCP does for you, but perhaps in a way that might be more efficient in the average case for small requests/responses) –  David Spillett Mar 4 '10 at 13:50
1  
David, in which case you'd be implementing HTTP over [whatever protocol you invented over UDP] and not merely HTTP over UDP. –  Daniel Papasian Mar 4 '10 at 14:00
add comment

TCP establishes a connection and UPD just sends packets.

You will have packet loss with UDP. Sites like youtube.com use UDP for video streaming because it doesn't matter if you miss a few frames. youtube.com uses UDP because it's faster than TCP because that connection isn't established and you probably wouldn't notice missing frames anyway.

You want to use TCP because you don't want packet loss.

share|improve this answer
    
When a video stream uses UDP, it also does so with a completely different protocol (such as RTSP). And HTTP - the website itself - always runs over TCP. –  grawity Feb 25 '10 at 19:21
    
Youtube does not use UDP, because UDP does not have any flow or congestion control mechanisms. Youtube would literally crash the traffic of the whole Internet if they used UDP! Streaming is done with TCP. –  user179697 Jun 29 '13 at 15:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.