If you're creating a media server how do you control if the files are pushed out via tcp or udp? Or is that a client thing? I'm currently building a headless Debian media server and I was wonsering how that words. As far as streaming videos in my house either one would probobly be fine, but if I am streaming from outside my home network I would want udp to be utilized. I'm hosting the files from a Debian NFS server. Thanks.

in general you would not use udp to transmit in a 'streaming' type mode, particularly outside of your locahost, udp does not guarantee delivery nor packet order - you can write code on top of udp to do handshaking ... to aid with reliability , it really depends on how much effort you want to put in ... ;

TCP is connection oriented, suitable for sending complete files. UDP is packet oriented, suitable for sending short messages. TCP will verify that all the data got to the destination, and in the proper order. UDP makes no guarantees. You will have to bake your own error recovery and retry logic.

In the case of a "media server", if a client connects to you via TCP, then you can send the data in a stream and not worry about it getting there properly, other than if something breaks the stream (network glitch or whatever). If you are just pushing out data, and let all the "listeners/receivers" get the data as desired, then you would use UDP - the receivers would need to deal with bad/missing data. With media that may not be a problem unless you have a lossy network environment. This is a "broadcast" environment, and TCP/IP does let you broadcast UDP messages to anyone on the network (LAN - broadcast packets usually don't travel outside of the local network), which the clients can listen for and receive. So, there are two real options for a media server. One is connection-oriented TCP streams where the clients connect to the server to get a stream. The other is where the media server broadcasts UDP packets to whoever wants to get them, kind of like radio.

I assumed that udp was best for streaming and that's what I've heard Netflix uses because that's the only way they can steam at a reasonable speed with varying internet connections. I was hoping to use TCP inside my home network but connect via udp if I was going to stream my media from another location.

Exactly, as rubben said tcp assures you that the information will be delivered, and no guarantees at all with udp, it just fires out packets. Streaming/skype etc find use of it

You could use RTP/RTCP over UDP for streaming. If memory serves me right VLC even has (some sort of) support for it.