Game Networking CS381 Spring 2012. Internet ● An information superhighway ● A collection of pipes ● Arpanet – Robust communication in the face of infrastructure.

Slides:



Advertisements
Similar presentations
Socket Programming ENTERPRISE JAVA. 2 Content  Sockets  Streams  Threads  Readings.
Advertisements

Introduction 2 1: Introduction.
Transport Layer3-1 Transport Overview and UDP. Transport Layer3-2 Goals r Understand transport services m Multiplexing and Demultiplexing m Reliable data.
Introduction 1-1 Chapter 3 Transport Layer Intro and Multiplexing Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley.
© Janice Regan, CMPT 128, CMPT 371 Data Communications and Networking Socket Programming 0.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Version 4.0 Network Services Networking for Home and Small Businesses – Chapter 6.
1 Java Networking – Part I CS , Spring 2008/9.
System Programming Practical session 10 Java sockets.
Networking Overview February 2, /2/2004 Assignments Due – Homework 0 Due – Reading and Warmup questions Work on Homework 1.
1 School of Computing Science Simon Fraser University CMPT 771/471: Internet Architecture and Protocols Socket Programming Instructor: Dr. Mohamed Hefeeda.
2: Application Layer1 Socket Programming. 2: Application Layer2 Socket-programming using TCP Socket: a door between application process and end- end-transport.
WXES2106 Network Technology Semester /2005 Chapter 8 Intermediate TCP CCNA2: Module 10.
Julia Ljunbjörk and Anita Mugenyi. What is a socket? Like a house Between the layers.
Process-to-Process Delivery:
Game Networking CS381 Sushil J. Louis Dept. of Computer Science and Engineering University of Nevada, Reno From and much thanks to
Administrative fun thing make sure to schedule some time with me to do a bit of project brainstorming do the IRB training  bring me a copy of the certificate.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Networking COMP # 21.
I. Basic Network Concepts. I.1 Networks Network Node Address Packet Protocol.
Discussion 2 Sockets Programming Applets TCP UDP HTTP Delay Estimation
Application Layer 2-1 ESERCITAZIONE SOCKET PROGRAMMING.
Vassil Roussev 2 A socket is the basic remote communication abstraction provided by the OS to processes. controlled by operating system.
Socket Programming Lee, Sooyong
TCP/IP Suite Transmission Control Protocol/ Internet Protocol Presentation by Chandra Porchia.
Introduction to Network Programming with Sockets Network Programming Kansas State University at Salina.
© Janice Regan, CMPT 128, CMPT 371 Data Communications and Networking Principles of reliable data transfer 0.
2: Application Layer1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
Dr. John P. Abraham Professor University of Texas Pan American Internet Applications and Network Programming.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
1 Chapter 28 Networking. 2 Objectives F To comprehend socket-based communication in Java (§28.2). F To understand client/server computing (§28.2). F To.
Application Network programming Using Java. Application Layer2-2 Socket programming socket: door between application process and end-end-transport protocol.
1 CSCD 330 Network Programming Fall 2013 Some Material in these slides from J.F Kurose and K.W. Ross All material copyright Lecture 8a Application.
CS2910 Week 3, Class 1 Today What is a protocol? Using TCP in Python Defining methods in Python Long procedure design SE-2811 Slide design: Dr. Mark L.
1 Kyung Hee University Chapter 11 User Datagram Protocol.
Socket programming in C. Socket programming Socket API introduced in BSD4.1 UNIX, 1981 explicitly created, used, released by apps client/server paradigm.
Data Communications and Networks Chapter 6 – IP, UDP and TCP ICT-BVF8.1- Data Communications and Network Trainer: Dr. Abbes Sebihi.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
Application Network programming Using Java. Application Layer2-2 Socket programming socket: door between application process and end-end-transport protocol.
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 33 Networking.
Socket Programming original by Joonbok Lee KAIST heavily adapted by /Jens.
Application Layer Functionality and Protocols Abdul Hadi Alaidi
Internet Socket Programing
Introduction to Networks
Chapter 11 User Datagram Protocol
Chapter 3 outline 3.1 Transport-layer services
Network Programming in Java CS 1111 Ryan Layer May 3, 2010
CS 3214 Computer Systems Networking.
Introduction to TCP/IP
Slide design: Dr. Mark L. Hornick
ROLE OF SQA Senthilkumar. R / 12/27/2016 Overview Fundamentals
Socket Programming Socket Programming Overview
Networking COMP
TCP – UDP Protocols Senthilkumar. R / 12/27/2016 Overview Fundamentals
CS 3214 Computer Systems Networking.
Introduction to Networks
Chapter 2 Application Layer
Transport Layer Our goals:
I. Basic Network Concepts
Process-to-Process Delivery:
Starting TCP Connection – A High Level View
Socket Programming Socket Programming Overview
TCP/IP Protocol Suite: Review
CSC Advanced Unix Programming, Fall 2015
CPEG514 Advanced Computer Networkst
CSCD 330 Network Programming
INFORMATION FLOW ACROSS THE INTERNET
Process-to-Process Delivery: UDP, TCP
Slide design: Dr. Mark L. Hornick
Based on Java Network Programming and Distributed Computing
Presentation transcript:

Game Networking CS381 Spring 2012

Internet ● An information superhighway ● A collection of pipes ● Arpanet – Robust communication in the face of infrastructure breakdown ● Packets instead of stream ● Routers send packets towards destination ● Incomplete knowledge of route to destination – Internet protocol - IP

IP

TCP and UDP over IP ● Connection based ● Guaranteed and Reliable ● Automatically packetizes ● Flow control ● Easy to use ● No concept of connection ● No guarantee of reliability or packet ordering ● Programmer packetizing ● Programmer flow control ● Programmer needs to handle lost packets

Sockets ● Network programming based on sockets – Open socket – Send on socket – Receive from socket

Socket code ● Send Thread ● While (true): – Get data – Send data on socket ● No blocking ● Receive Thread ● While (true): – Receive data from socket – Process data ● Blocked on receive

Python code # TCP server example import socket server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_socket.bind(("", 5000)) server_socket.listen(5) print "TCPServer Waiting for client on port 5000" while 1: client_socket, address = server_socket.accept() print "I got a connection from ", address while 1: data = raw_input ( "SEND( TYPE q or Q to Quit):" ) if (data == 'Q' or data == 'q'): client_socket.send (data) client_socket.close() break; else: client_socket.send(data) data = client_socket.recv(512) if ( data == 'q' or data == 'Q'): client_socket.close() break; else: print "RECIEVED:", data

Python code (Receive) # TCP client example import socket client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client_socket.connect(("localhost", 5000)) while 1: data = client_socket.recv(512) if ( data == 'q' or data == 'Q'): client_socket.close() break; else: print "RECIEVED:", data data = raw_input ( "SEND( TYPE q or Q to Quit):" ) if (data <> 'Q' and data <> 'q'): client_socket.send(data) else: client_socket.send(data) client_socket.close() break;

UDP Server # UDP server example import socket server_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) server_socket.bind(("", 5000)) print"UDPServer Waiting for client on port 5000" while 1: data, address = server_socket.recvfrom(256) print "( ",address[0], " ", address[1], " ) said : ", data

UDP Client # UDP client example import socket client_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) while 1: data = raw_input("Type something(q or Q to exit): ") if (data <> 'q' and data <> 'Q'): client_socket.sendto(data, ("localhost",5000)) else: break client_socket.close()

Action Game Networking ● TCP not suitable – We are interested in most recent game state more than in reliably receiving game state – If there is network congestion TCP/IP may make congestion worse and worse with lots of resending of lost packets and acknowledgements

UDP Game networking ● Fixed sized packets ● Screen to find players and make game – Or broadcast on local net for local net game ● Specify authoritative server ● Ensure no possibility of cheating – Encryption ● Design Game networking protocol

381 engine ● Packet size: ● Server broadcasts state every 100 ms ● No encryption ● Protocol – Server – Client

Breakout

Protocol for openEcslent ● Server – Broadcast state every 100 ms – Service client requests ● Client – Receive msg – Update state – Send user interaction

Server ● Sender Thread – Broadcast state – Broadcast send queue – Sleep 100 ms ● Receiver Thread – Receive msg – Store in receive queue ● Network Manager – every tick – Process receive queue – Put requested data in send queue

Client ● Sender Thread – Send all messages in Send Q – Sleep 100 ms ● Receiver Thread – Receive message – Put message in Receive Q ● Network Manager – every tick – Process all messages in Receive Q – Put new messages in Send Q

Big picture Game Engine Gfx Mgr Entity Mgr Network Mgr Network Sender Thread Network Receiver Thread tick Thread run loops

Details Read code!