DCN Review
The signal-to-noise ratio is often given in decibels.
Assume that
Physical Layer:
Data Link Layer:
Network Layer:
Transport Layer:
Session Layer:
Presentation Layer:
Application Layer:
Physical Layer:
Guided media, which are those that provide a conduit from one device to another.
wired
Unguided media transport electromagnetic waves without using a physical conductor.
wireless
Two common signal encoding methods:
The Electromagnetic Spectrum
Data Link Layer:
forward error correction (FEC)
Error detection:
Error correction:
Network Layer:
governs the data format of packets
sent over the Internet.IPv4 | IPv6 | |
---|---|---|
IP address | 32 bit | 128 bit |
Address Notation | Numeric dot-decimal notation | Hexadecimal notation |
Header size | 20 bytes + optional | 40 bytes |
Checksum | Yes | No |
Network routing selects a path over an internetwork to transmit one or more packets from the source to the destination.
Transport Control Protocol (TCP)
User Datagram Protocol (UDP)
Socket is an abstraction through which an application may send and receive data.
WSAStartup
socket
connect
(send, recv) (recusive)
closesocket
WSACleanup
WSAStartup
socket
bind
listen
accept
(recv, send) (recursive)
closesocket (pair up with accept)
WASCleanup
.int socket_desc=socket(AF_INET,SOCK_STREAM,0);
if (socket_desc==-1) perror("Create socket");
struct sockaddr_in address;
/* type of socket created in socket() */
address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY; /* 7000 is the port to use for connections */
address.sin_port = htons(7000); /* bind the socket to the port specified above */
bind(socket_desc,(struct sockaddr *)&address,sizeof(address));
listen(socket_desc,3);
int addrlen;
struct sockaddr_in address;
addrlen = sizeof(struct sockaddr_in);
new_socket = accept(socket_desc, (struct sockaddr *)&address, &addrlen); if (new_socket<0) perror("Accept connection");
char *message="This is a message to send\n\r";
send(socket_desc, message, strlen(message), 0);
int bufsize=1024; /* a 1K buffer */
char *buffer=malloc(bufsize);
recv(socket_desc,buffer,bufsize,0);
closesocket(msg_sock);
// close(socket_desc);
WSACleanup();
#include <process.h>
for(int i = 0; i < 100; i++){
_beginthread(accept_conn, 0, NULL );
}//for loop
_endthread();
// create a function to accept a connection
void accept_conn(void *dummy) {
// doing something here
}
10 Mbps
100 Mbps
1 Gbps
10 Gbps
Data transmission time
Cable length
(线缆长度)Propagation speed
(传播速度)Bit rate
(比特率,单位为比特/秒)Minimum data size
(最小数据大小)集线器
Hub is a repeater with some additional network management functionality (such as performance or accounting management)
Work on 02-Physical Layer
桥接器
Bridge: bridge operates on Ethernet frames and thus a layer-2 device. It does the following two functions:
Work on 03-Data Link Layer
路由器
Work on 04-Network Layer
交换机
Switch: switch is in essence a high-performance multi-interface bridge. The difference between a bridge and switch:
Bridges usually two or four interfaces, whereas switches have dozens of interfaces (e.g., 24 ports).
Switches are usually used to connect individual computers, and operate in a full-duplex mode.