180 likes | 290 Views
Network Programming. All networked computers have an IP Address Unique In the form of xxx.xxx.xxx.xxx (255.255.255.255) 32 bits = ~4 billion possibilities (IPv4) Most computers have multiple network cards called “interfaces” Wireless card Ethernet adapter VPN. From the cmd. Ports.
E N D
Network Programming • All networked computers have an IP Address • Unique • In the form of xxx.xxx.xxx.xxx (255.255.255.255) • 32 bits = ~4 billion possibilities (IPv4) • Most computers have multiple network cards called “interfaces” • Wireless card • Ethernet adapter • VPN
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: • www.google.com • 74.125.47.106
Client/Server • Servers wait – a LOT • Client wants some data/service from server • Process • Client connects to server • Client sends request for info • Server finds the information • Server sends the information • Client/Server disconnect?
“One-shot” Servers Gee, I’m lonely I need a texture!
“One-shot” Servers Someone loves me! Make a connection
“One-shot” Servers Let me find that for you… GET spriteSheet.png
“One-shot” Servers Here ya go! <DATA>
“One-shot” Servers Gee, I’m lonely
“Broadcast” Servers A B C
“Broadcast” Servers A B C One thread per client
“Broadcast” Servers Here are my coordinates! A <375.0, -41.0> B C
“Broadcast” Servers Hey guys! “A” has moved A “A” is at <375.0, -41.0> B “A” is at <375.0, -41.0> C
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”