a networking primer about sockets

5
Lecture 2 - Håkan Jonsson 1 Networked VE Lecture 2 Chapter 4 Communication Architectures Peer-to-peer Client-Server Reminder: Quizz on Lecture 1on Friday! Chapter 3 A Networking Primer Latency, Bandwidth, Reliability, Protocols TCP, UDP, Broadcast, Multicast Multiple servers Lecture 2 - Håkan Jonsson 2 A Networking Primer Fundamentals Network Latency (“Network Delay”) Time to transfer one (1) bit from source to destination. Delays updates received over the network. – Bandwidth • The rate at which data can be delivered. Network Reliability How much data is lost by the network during the transmission from source to destination. – Dropping – Corruption – Protocol Defines the rules by which communication is performed. – Formats Packet semantics Error behavior Lecture 2 - Håkan Jonsson 3 About Sockets •A socket is a software representation of an end point of a communication channel. A common abstraction independent of the actual kind of communication used. Source/destination host address •A port or destination application idnumber identifies one particular socket among the 65 536 available at a host. There could be several active communication channels in use at the same time each of which use different ports. Many port numbers are reserved for well-known applications. Port numbers 49 152 – 65 536 are free. Lecture 2 - Håkan Jonsson 4 IP The Internet Protocol. A bit strange, but sometimes referred to as the IP Protocol. A low-level protocol that ensures that packets travel from source to destination. Not needed to specify which way packets should be routed. Copes with heterogeneous networks. SAR, segmentation and reassembly. TTL, time-to-live. Not used explicitly by applications. Applications typically use some higher-level protocol that is implemented using the IP.

Upload: others

Post on 31-Jan-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A Networking Primer About Sockets

Lecture 2 - Håkan Jonsson 1

Networked VE

Lecture 2

Chapter 4

Communication Architectures

Peer-to-peer

Client-Server

Reminder: Quizz on

Lecture 1on Friday!

Chapter 3

A Networking Primer

Latency, Bandwidth,

Reliability, Protocols

TCP, UDP,

Broadcast, Multicast

Multiple

servers

Lecture 2 - Håkan Jonsson 2

A Networking Primer

• Fundamentals– Network Latency (“Network Delay”)

• Time to transfer one (1) bit from source to destination.

• Delays updates received over the network.

– Bandwidth

• The rate at which data can be delivered.

– Network Reliability

• How much data is lost by the network during the transmission fromsource to destination.

– Dropping

– Corruption

– Protocol

• Defines the rules by which communication is performed.

– Formats

– Packet semantics

– Error behavior

Lecture 2 - Håkan Jonsson 3

About Sockets

• A socket is a software representation of an end pointof a communication channel.– A common abstraction independent of the actual kind of

communication used.

• Source/destination host address

• A port or destination application idnumber identifies oneparticular socket among the 65 536 available at ahost.– There could be several active communication channels in

use at the same time each of which use different ports.

– Many port numbers are reserved for well-knownapplications.

– Port numbers 49 152 – 65 536 are free.

Lecture 2 - Håkan Jonsson 4

IP

• The Internet Protocol.– A bit strange, but sometimes referred to as the IP

Protocol.

• A low-level protocol that ensures that packets travelfrom source to destination.– Not needed to specify which way packets should be

routed.

– Copes with heterogeneous networks.

– SAR, segmentation and reassembly.

– TTL, time-to-live.

– Not used explicitly by applications.• Applications typically use some higher-level protocol that is

implemented using the IP.

Page 2: A Networking Primer About Sockets

Lecture 2 - Håkan Jonsson 5

Internet Protocols for net-VE:s

• TCP - Transmission Control Protocol– Point-to-point with reliable transmission.

– Streams.

• UDP - User Datagram Protocol– “Best effort” only (packets could disappear without a trace).

• (IP)

• IP Broadcast (using UDP)– “Best effort” transmissions to all hosts on a LAN (Local Area

Network).

– Appropriate for small LAN:s and low-bandwidth transmissions.

• IP Multicast– Efficient “best effort” data transmission to multiple destination hosts

whose individual identities are anonymous to the transmitter.

– Appropriate for the Internet and large-scale systems.

Lecture 2 - Håkan Jonsson 6

Selecting a Protocol

• Depends on the needs of the application (the

net-VE).

• Table 3-3.

• 77-82 goes through the benefits and

drawbacks of the protocols TCP, UDP, IP

Broadcast, and IP Multicast.

Lecture 2 - Håkan Jonsson 7

Communication Architectures

• How should communication between participants(local applications running on the users’ computers)be handled?

• How should the common state, i.e. the datadescribing the common virtual environment, bedistributed? Updated?

• Logical connections.– How messages are sent, flow.

– Implemented as physical connections (wires, forinstance).

Lecture 2 - Håkan Jonsson 8

Performance

• The communication architecture should be chosen based onthe need of the net-VE.

• Calculate the worst and best possible performance inadvance.– How many simultaneous users? Autonomous entities?

• Base the calculation on:– Data format used to transmit changes over the network.

– Entities that are part of the net-VE and generate traffic.

– Data traffic generated by each kind of entity.

• Rate?

– Physical network properties; Bandwidth.

– Host capacity.

– Mix of entities at the hosts?

– Other traffic that consumes network recourses?

Page 3: A Networking Primer About Sockets

Lecture 2 - Håkan Jonsson 9

Example (p. 88-)

• 2 players engaged in a networked combat game on a LAN.

• Data format– Distributed Interactive Simulation (DIS) Protocol Data Unit (PDU).

– Size of each packet: 144 bytes = 1152 bits.

• Entities that are part of the net-VE and generate traffic.

– Aircraft, ground vehicles, weapons, fully articulated soldiers (humans).

• Data traffic generated by each kind of entity.

– Aircraft: 12 PDU/s

– Ground vehicles: 5 PDU/s

– Weapons firing: 3 PDU/s

– Soldier: 30 PDU/s

• Physical network properties; Bandwidth.

– Modems: ~56 kbit/s

– Ethernet LAN: ~10 Mbit/s

– Wide Area Networks (WANs): ~1.5 Mbit/s

NPSNET-IV (30 fps, see Ch. 2)

Lecture 2 - Håkan Jonsson 10

(Example p. 88-)

• Host capacity.– Sufficiently fast computers, i.e. not a bottleneck.

• Mix of entities at the hosts?– Many alternatives.. choose best/worse cases.

• Other traffic that consumes network recourses?– Web browsing? NFS (File transfers)? Email? …

– None assumed.

Lecture 2 - Håkan Jonsson 11

(Example p. -89)

• Ethernet LAN transmitting at 10 Mbit/s equals 8680DIS packets/s, each with a PDU.

– Soldiers firing weapons [every second]: 263 entities

– Aircraft firing weapons: 578 entities

– Ground vehicles firing weapons: 1085 entities

• A real scenario includes a combination ofentities.– NPSNET-VI Battles cope with at most around

300 players [p. 89].

– NB! An entity can be human or computercontrolled.

Lecture 2 - Håkan Jonsson 12

(Example p. -89)

• What if players connect to the Internet usingmodems transmitting at 56 Kbit/s, that equals 48DIS packets/s each with a PDU?– This admits only either 1 soldier, 3 aircraft, or 6 ground

vehicles, each firing.

• Solution? Re-think the packet format!– Smaller packet size means more packets/s, which implies

more entities.

– Possible to shrink packet size from 144 bytes to 32 bytesin this particular case [p.89].

• This “boosts” the number of entities to 7 soldiers, 14 aircraft, or27 ground vehicles.

Page 4: A Networking Primer About Sockets

Lecture 2 - Håkan Jonsson 13

Multiplayer Client-Server

• Each user sends packets to other users via a

server.

Lecture 2 - Håkan Jonsson 14

(Multiplayer Client-Server)

• Drawback:– Likely bottleneck.

• Benefits:– Reduce overall traffic by

• sending a particular user data that only that user need.

• compressing multiple packets into one.

– Convert bursty packet reception into smoother packetrates.

– Reliable communication.

– Preferable if there are administrative tasks that must beperformed (like keeping track of how much time a userhas spent in the net-VE).

Lecture 2 - Håkan Jonsson 15

(Multiplayer Client-Server)

• Physical architecture: LAN

Lecture 2 - Håkan Jonsson 16

(Multiplayer Client-Server)

• Physical architecture: Phone lines

Page 5: A Networking Primer About Sockets

Lecture 2 - Håkan Jonsson 17 Lecture 2 - Håkan Jonsson 18

Multiple Servers• Have several servers, with each server serving a number of

users.– Communication between users could end up going via many servers.

• Increases latency.

– Servers synchronize their state among themselves.

• Demands high-speed server-server communication.

• Allows growth beyond the limits of a single server.

Lecture 2 - Håkan Jonsson 19

Peer-to-Peer Architectures

• No servers! Direct communication betweenusers (hosts).– Benefits

• Scalable.

• No need for a dedicated server [and a machine to runit on].

– Drawbacks• Less control of data [easier to cheat?].

• More complicated to enter the net-VE.

• (Distributed - There is no central point where globaldecisions are made.)

Lecture 2 - Håkan Jonsson 20

(Peer-to-Peer Architectures)

• How widespread should the net-VE be?– LAN?

• Multicast (also Broadcast but could led to a very busyLAN)

– WAN?• Broadcast is not an option.

– Most routers block these.

• Multicast?!– Problem: Multicast-capable routers are not deployed

everywhere.

– Solution? Specially designated machines tunnel multicastpackets (in UDP packets) through parts of the Internetwhere multicast is disabled.