制式
美国有4种格式手机卡,网络和频率分别如下:
gsm:(800)/1900
tdma:(800)/1900
cdma:(800)/1900
(amps:800)
我国 GSM 通信系统采用 900MHz 和 1800MHz 频段。WCDMA 2100MHz
RF前端
socket编程
关于关闭socket之后出现address already in use
SO_REUSEADDR | SO_REUSEPORT
I've run into that same issue as well. It's because you're closing your connection to the socket, but not the socket itself. The socket can enter a TIME_WAIT state (to ensure all data has been transmitted, TCP guarantees delivery if possible)
一定要close(fd),要不然即使pthread_cancel之后,没有 close(fd),还是会出现address already in use.
Bind: Address Already in Use Or How to Avoid this Error when Closing TCP Connections
http://hea-www.harvard.edu/~fine/Tech/addrinuse.html
setsockopt及keepalive
SO_BINDTODEVICE
Bind this socket to a symbolic device name like eth0 instead of using bind() to bind it to an IP address. Type the command ifconfig under Unix to see the device names.
SO_REUSEADDR
Allows other sockets to bind() to this port, unless there is an active listening socket bound to the port already. This enables you to get around those "Address already in use" error messages when you try to restart your server after a crash.
http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/
# cat /proc/sys/net/ipv4/tcp_keepalive_time
7200(s)
# cat /proc/sys/net/ipv4/tcp_keepalive_intvl
75(s)
# cat /proc/sys/net/ipv4/tcp_keepalive_probes
9次
修改为:
# echo 600 > /proc/sys/net/ipv4/tcp_keepalive_time
# echo 60 > /proc/sys/net/ipv4/tcp_keepalive_intvl
# echo 20 > /proc/sys/net/ipv4/tcp_keepalive_probes
sudo nano /etc/sysctl.conf:
net.ipv4.tcp_keepalive_time = 600
net.ipv4.tcp_keepalive_intvl = 60
net.ipv4.tcp_keepalive_probes = 20