-
TCP:
- Connection based
- Guaranteed reliable and ordered
- Automatically breaks up your data into packets for you
- Makes sure it doesn’t send data too fast for the internet connection to handle (flow control)
- Easy to use, you just read and write data like its a file
-
UDP:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from pymodbus.client.sync import ModbusSerialClient | |
import logging | |
logging.basicConfig() | |
log = logging.getLogger() | |
log.setLevel(logging.DEBUG) | |
client = ModbusSerialClient(method='rtu', port='/dev/ttyM0', baudrate=38400, parity='N', bytesize=8, stopbits=1, timeout=1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import serial | |
import binascii | |
ser=serial.Serial('/dev/ttyM0', baudrate=38400, timeout=1) | |
ser.write(binascii.unhexlify('010200010001e80a')) | |
r = ser.read(16) | |
if r is not None: | |
print repr(binascii.hexlify(r)) |
qmicli -d /dev/cdc-wdm0 -p --nas-get-signal-strength
qmicli -d /dev/cdc-wdm0 -p --dms-uim-verify-pin=PIN,0000
qmicli -d /dev/cdc-wdm0 -p --wds-start-network=internet --client-no-release-cid --device-open-net='net-802-3|net-no-qos-header'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%% | |
%%% Prepare Chinese Font of 微軟正黑體 | |
%%% | |
%%% Make PDF file: | |
%%% xelatex xetex-sample.tex | |
%%% | |
\documentclass{article} | |
\usepackage{xeCJK} | |
\setCJKmainfont[BoldFont=msjhbd.ttf]{msjh.ttf} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
if [ "$#" -ne 1 ]; then | |
echo "Need parameter for HOST IP/NAME." | |
fi | |
MY_HOST=$1 | |
cd /etc/openvpn |