Unless you really know what you are doing, the easiest bet is to use existing
higher-level protocols instead of just "sockets".
For example, 10-15 lines of code with
HTTP::Daemon will get
you a server waiting for a request, and another 5-10 lines of code will
let you use
HTTP::Request::Common to
POST your file
to be transferred, even passing some authentication to verify the source
of the transmission. Using raw sockets, you'd be hard-pressed to even
get the socket open in that few lines.
-- Randal L. Schwartz, Perl hacker