Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 49 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
49
Dung lượng
1,51 MB
Nội dung
Oẳn Tù Tì Game Report Game GVHD : Group menbers: TS Nguyễn Đức Thái Mai Văn Tinh Võ Thanh Biết Đỗ Luật Khoa Nguyễn Phúc Ánh Overview Game 6.Demo 2.Model What next Game activity Socket Client-Server Extension Overview Game Problems Who win Network Player Player 2.Model Client/Server model Client Request Response Request Response Request Client Response Server 2.Model Features of Client/Server Architecture • Multi-user support Server can process requests from multiple clients simultaneously • Transparency of location Clients need not be aware of physical location of server • Mix and match of platforms Client and server may have heterogeneous platforms • Scalability Provides scope for scalability and ease of maintenance Socket Client-Server Socket Multicast Thread Socket Client-Server - Socket: Sockets are network communication link end-points between two applications (i.e., server and client) Source : Advanced Network Programming Principles and Tecniques Socket Client-Server - Socket: Sockets are network communication link end-points between two applications (i.e., server and client) Figure The java.net package - - There are two type of Sockets: - - Transport layer socket: TCP and UDP - - Application layer Socket: HTTP, SMTP Image from: http://bioinfo2.ugr.es/OReillyReferenceLibrary/java/fclass/ch15_js.htm Socket Client-Server important parameters: IP address, port number, and communication protocol (TCP) TCP Socket :Server Side ServerSocket servSock = new ServerSocket(portno); /*1024 ...1 Overview Game 6.Demo 2.Model What next Game activity Socket Client-Server Extension Overview Game Problems Who win Network Player Player 2.Model Client/Server... socket.close() Game Actvity Invite player Client A Server Client B send request ‘Invite B’ read request validation send invitation of A to B read request send ‘Accept’ read request validation send ‘Begin Game ... packet = new DatagramPacket(data, ipClient, portClient) socket.send(packet) socket.receive(packet) Game Actvity Connect server Server Client socketSV = new ServerSocket(4447) socket = socketSV.accept()