Re: Glibmm and networking



On Sat, 2007-10-06 at 09:22 +0100, Robert Pearce wrote:
> On Sat, 6 Oct 2007 00:00:01 -0300 you wrote:
> > Jonathon, thanks for help.  I�ve read that Glib::IOChannel could be
> > bound to sockets, but don�t know if sockets could be used for
> > transfering files over network 
> 
> Not directly. A socket is simply a connection between two nodes, in much
> the same way that a null modem cable is. When you access a file by FTP or
> HTTP you are using a socket (two in the case of FTP) to do the actual
> communication, but what you send and receive includes a lot of protocol
> in addition to the data.

Everything you have said is right, but a file can be transferred using
sockets with no transfer level protocol if all the user wants to do is
capture the bytes and write them to a file at the receiving end.  In
other words, the sender can open a socket at the server (receiver) end,
write all the bytes of a file to the socket and close the socket, and
the receiver can keep writing all the received bytes to the filesystem
until read() or recv() returns 0 (ie the socket is closed), and if the
socket has not failed then an exact replica of the file will have been
transferred.

If that is all the OP wants to do, say to transfer files on his local
network, then using raw sockets will be fine.

But once he wants to do even something as simple as having the receiver
know what the name of the file was at the sending end, so the receiver
can give it the same name (if that is important) at the receiving end,
then some transfer level protocol is needed, even if a home-produced
one.

Chris





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]