Network Programming All networked computers have an IP Address – Unique – In the form of xxx.xxx.xxx.xxx ( ) – 32 bits = ~4 billion possibilities (IPv4) Most computers have multiple network cards called “interfaces” – Wireless card – Ethernet adapter – VPN
From the cmd
Ports Machine can specify one of ~65K ports – Allows for multiple network connections – First 1024 are reserved by the OS Common ports – 21 FTP (File Transfer Protocol) – 22 SSH (Secure Shell) – 23 Telnet – 25 SMTP (Simple Mail Transfer Protocol) – 80 HTTP (HyperText Transfer Protocol) – 110 POP3 (Post Office Protocol) ** 13 is Time Protocol and 17 is Quote of the Day
DNS Domain Name Service – Translates human-readable into IP Address – Relieves burden of memorization! – This is what many applications use Example: – –
nslookup
Client/Server Servers wait – a LOT Client wants some data/service from server Process 1.Client connects to server 2.Client sends request for info 3.Server finds the information 4.Server sends the information 5.Client/Server disconnect?
“One-shot” Servers
Gee, I’m lonely I need a texture!
“One-shot” Servers Make a connection Someone loves me!
“One-shot” Servers GET spriteSheet.png Let me find that for you…
“One-shot” Servers Here ya go!
“One-shot” Servers Gee, I’m lonely
“Broadcast” Servers A B C
One thread per client A B C
“Broadcast” Servers Here are my coordinates! A B C
“Broadcast” Servers “A” is at A B C Hey guys! “A” has moved
Summary IP Address Port Client/Server relationship Programming: – If you can read/write to files, you can read/write to the network – Developing “Poor Man’s Web Browser” – Developing “Poor Man’s Web Server”