-
Sockets allow communication between two different processes on the same or different machines.
-
A socket is just a logical endpoint for communication. They exist on the transport layer.
-
TCP socket
- Type: SOCK_STREAM
- reliable delivery
- in-order guaranteed
- connection-oriented
- bidirectional
-
UDP socket
- Type: SOCK_DGRAM
- unreliable delivery
- no order guarantees
- no notion of “connection” – app
- indicates destination for each
- packet
- can send or receive
- Client: Client connects to a server, recieves in buf
- Server: Server connects to a client, sends data and and print clients IP and PORT
- Client: Client connects to a server, sends data and recieves in buf
- Server: Server connects to a client, recieves buf, converts it into ALLCAPS and send data
- Client: Client connects to a server, sends data and recieves in buf continuously
- Server: Server connects to a client, sends data and recieves in buf continuously
- Client: Client Recieves the file and diconnects
- Server: Server sends a file to every client connected