05-10-2012, 01:11 PM
Introduction to Linux Network
LinuxNetwork.ppt (Size: 598 KB / Downloads: 126)
TCP Overview
TCP (Transmission Control Protocol)
Connection-Oriented
Reliable Protocol
UDP (User Datagram Protocol)
Connectionless
Unreliable Protocol
IP Overview
32-bit Unique IP Address
Network Address
Subnet Address
Host Address
Linux Networking Layers
Support Mechanism
Various Networking
Inter-Process Communication
A Special Kind of Pipe
Support Several Address Family…
Support Several Socket Type…
The INET Layer
BSD Socket
A part of VFS inode
A socket can be operated just the same as a file by system call read(), write(), lseek()…
INET Layer use sock data structure to handle BSD socket
Binding an Address
Only for Server
Int bind(int sockfd, const struct sockaddr *address, size_t add_len)
Port Number is optional for binding
socket.socket_state = TCP_CLOSE;
The bound socket can’t be used for other communication
The bound addr was saved in sock.rcv_saddr
UDP maintains a hash table udp_hash to allocate UDP port
TCP doesn’t add the binding sock to hash table during binding operation
Connecting
Only for client
Before connecting,
socket.socket_state = SS_UNCONNECTED;
Int connect(int csockfd, const struct sockaddr *address, size_t add_len)
Add the sock to tcp_listening_hash waiting for server’s response