I can get netcat to stream a video using TCP
{server} cat [movie].avi | nc [client ip address] 65535
{client} nc -l -p 65535 | mplayer -
i have tried using the -u command to send via UDP but this doesn't work
{server} cat [movie].avi | nc -u [client ip address] 65535
{client} nc -u -l -p 65535 | mplayer -
Any ideas?
There is a fundamental difference between streaming bytes with TCP and UDP...
The consequences are that your TCP example works, but the UDP example doesn't because mplayer never knows when to process the bytes it is getting.
One way to solve this is with a timeout on both sides... First start your client with a timed finish (backgrounding the nc portion in a subshell so it won't block):
(nc -q 1 -u -l -p 65535 > [movie].avi&); sleep 10; fuser -k 65535/udp;\
mplayer [movie].avi; rm [movie].avi
Next start your server... in this case, I show it pushing the file to 192.168.12.238 on udp/65535
(cat [movie].avi | nc -u 192.168.12.238 65535&); sleep 10; \
fuser -n udp ,192.168.12.238,65535 -k
Finally, be sure you choose the timeout to be long enough to sequence the shell commands and finish the network transfer (which is normally rather quick, if you're on a wired ethernet LAN).