The first question is a little vague, but it could describe multiplexing (Statistical, Time Division, Wave Division, etc)
The second function is the job of the protocol stack (whichever protocol stack you happen to be using).
Refer to the OSI model (Layer 1 -> 7)
Good Luck
Scott