Presentation is loading. Please wait.

Presentation is loading. Please wait.

INTRO TO NETWORKING. OVERVIEW Transmitting data Across a physical media Ethernet Wi-fi Bluetooth Etc. Cross-platform (usually) Challenges Varying network.

Similar presentations


Presentation on theme: "INTRO TO NETWORKING. OVERVIEW Transmitting data Across a physical media Ethernet Wi-fi Bluetooth Etc. Cross-platform (usually) Challenges Varying network."— Presentation transcript:

1 INTRO TO NETWORKING

2 OVERVIEW Transmitting data Across a physical media Ethernet Wi-fi Bluetooth Etc. Cross-platform (usually) Challenges Varying network speed / bandwidth Corrupt messages No global clock Have to code asynchonously Events (data received) can happen at any time. Data may not be ready when needed.

3 NETWORK LAYER MODEL / PACKETS An application on Computer A wants to send a piece of data ( packet ) Hey, dude-man! Application A (Computer A) Transmission / Control OS layer aaa a Hey, dude-man! bb b aaa a Hey, dude-man! Internet OS layer Transmission Media Hey, dude-man! aaa a Hey, dude-man! bb b aaa a Hey, dude-man! Application B (Computer B)

4 KEY PROTOCOLS Transmission / Control Layer Error detection Connecting to a client / server Ports [see online list] TCP : connection-oriented, guaranteed delivery UDP : connectionless, most-of-the-time delivery Internet Layer Routing of packets IP address Routers / Switches Major variants: IP is most common IPX is another.

5 SOCKETS A very low-level library Written in C (every language has a wrapper) Socket objects… Are a little like file handles. We open a connection… read data to a socket… write data to a socket… detect errors with a socket Connection dropped No data waiting …

6 EXAMPLE #1 Connect to a real server and send an HTTP(S) GET request. [Write code together]

7 EXAMPLE #2 Connect to my computer Send me a string of data and quit.

8 SOME DESIGN PATTERNS Peer-to-Peer clients connect to each other old-school LAN games (e.g. Starcraft) Client-Server ping-pong server (not a real term ) Clients send data to server Server repeats this data to all (other) clients. server-authority Server maintains data on game-state Clients create some objects (e.g. their own bullets) Server informs other clients (other client's bullets) Lobby Server waits for n clients to connect Then it spawns a VM with a server that all matched clients use. … (many, MANY more)

9 DESIGNING A PROTOCOL Client Server client sends connection request server accepts

10 EXAMPLE #3 Mostly-untested-probably-broken-example.

11 MORE SILLINESS Additional complications for a real server packet-size limitations…grr. multi-threaded? broadcast messages (for LAN server discovery)? …


Download ppt "INTRO TO NETWORKING. OVERVIEW Transmitting data Across a physical media Ethernet Wi-fi Bluetooth Etc. Cross-platform (usually) Challenges Varying network."

Similar presentations


Ads by Google