Lab 2
Lab 2
Lab 2
Inha University
1. Bind
2. Socket
3. Listen
4. Connect
5. Accept
?
1. Socket
Protocol
Protocol
• What is “Protocol”?
• Network protocols are formal standards and policies comprised of rules, procedures and
formats that define communication between two or more devices over a network.
• It needs to be specified to create a socket (so socket needs to know the protocol type)
• It’s like a detailed deal between two people for co-working (or just communicating)
• The both parties can communicate with each other using the agreed terms and conditions
Domain, Type, Protocol
• Socket domain
• PF_XXX Protocol Family XXX
• PF_INET = Protocol Family Internet (IPv4)
• AF_XXX Address Family XXX (each address family supports multiple protocol families)
• AF_INET = Address Family Internet (IPv4)
• Socket type
• SOCK_STREAM TCP (Transmission Control Protocol – Two-way handshaking)
• Connection oriented = stable
SOCK_STREAM SOCK_DGRAM
? ?
Domain, Type, Protocol
Bind()
Listen()
Accept()
Now lets create our own socket
connect()
recv()
Data transmission