Help socket prog

HI
Can anyone provide me with codes for file transfer server to client or vice versa?
Also please explain how to compile those programs in ubuntu terminal as i am totally new to socket programming.

Thanks