Streams in computing
Question: In the world of computing, majorly i've been reading python programming
language and the socket module I understand that the sockets in communication
are just communications end-points, which every communication done uses a
socket.

    
    
    import socket
    #Importing the low-level socket module in python
    

But what i have been trying to grasp is streams, i understand them though, but
is it enough to just think of streams as the road connecting two sockets
together where other things like bytes and packets drive on from one place to
the other or there is more to it? Thanks for your simple but through
explanation


Answer: The main difference between a "file" and a "stream" is that a stream cannot be
rewound and read (or written) again. Also, a "stream" usually has no concept
of "framing", meaning it is just a pipe with bytes flowing through, as opposed
to a "message queue" or a "datagram socket". TCP sockets are considered stream
sockets, whereas UDP ones are "datagram" sockets meaning that the boundaries
between message bodies are explicit in the protocol. With a stream you often
need to implement your own framing or "envelope" protocol on top.

