PeerFinder.Role = PeerRole.Client; PeerFinder.Role = PeerRole.Host;

Slides:



Advertisements
Similar presentations
Complete Structure class Date {class Date { private :private : // private data and functions// private data and functions public :public : // public data.
Advertisements

1 Working with the Bluetooth radio Nilanjan Banerjee Mobile Systems Programming University of Arkansas Fayetteville, AR
EEE436 / CS422 Preliminary Presentation Group
APIWP7.1WP8W8 System.Net.WebClient  System.Net.HttpWebRequest (async only) System.Net.Http.HttpClient (NuGet) Windows.Web.Syndication.SyndicationClient.
EEE436 / CS422 Final Presentation Group
Msdevcon.ru#msdevcon. Windows Phone 8 Networking Survival Kit Andy Wigley Microsoft UK.
CS 4800 By Brandon Andrews.  Specifications  Goals  Applications  Design Steps  Testing.
System Programming Practical session 10 Java sockets.
Java sockets. From waiting.
Cloud-powered apps Apps that fetch content from the web or peer devices Faster, More Capable Built using networking APIs in Windows Higher performance.
Discovering Devices or Services over the Local Network
MSDN How do I add Voice Commands to my application Find Install Voice Command Sets Search Search for {dictatedSearchTerms} Find Find.
Web Proxy Server. Proxy Server Introduction Returns status and error messages. Handles http CGI requests. –For more information about CGI please refer.
Recognizes: Magic Memo, show me memo number three. Magic Memo, show memo one. Magic Memo, display memo number two. Magic Memo, display memo.
Managed Code Generics Language Integrated Query Dynamic + Language Parity C# VB 11.0 Windows Runtime + Asynchrony C# VB 7.0 C# VB.
Performance measurements for inter-process communication.
CS4273: Distributed System Technologies and Programming I Lecture 5: Java Socket Programming.
Web Security Programming I Building Security in from the Start Except where otherwise noted all portions of this work are Copyright (c) 2007 Google and.
Network Layer Programing Connection-Oriented Sockets SWE 344 Internet Protocols & Client Server Programming.
Demo: File->New Project Demo: Bundling & Minification.
CSCI 6962: Server-side Design and Programming Introduction to AJAX.
Network Status Indicator Data Binding to update scores Multiple players in one game LINQ to simplify coding Storyboard controlled animation Async socket.
Agenda Windows Phone History WP 7.0 Silverlight WP 7.5 Silverlight WP 8.0 Silverlight WP 8.1 Silverlight WP 8.1 WinRT.
Datacenter LOB web service LOB app Partner Mobile Device.
Windows Phone 8 Tips & Tricks for Developers Sascha Corti, Microsoft Switzerland Technical Evangelist | techpreacher.corti.com.
// OPTIONAL: Set some custom name to identify self to others. PeerFinder.displayName = myNameToDisplay; PeerFinder.ConnectionRequested.
“Thanks guys for a great information packed day. head is spinning!” “Well done guys. Intense sessions” “This is the best ever JumpStart that I have.
Cli/Serv.: Chat/121 Client/Server Distributed Systems v Objectives –discuss a client/server based chat system –mention two other ways of chatting.
Windows News app uses Notification Hubs Platform Notification Service App back-end Client app.
Online Service 1. Authorization Request (Start URL) 2. Login page 3. Credentials 4. Authorization page 5. User decision 6. Authorization.
Data Streams David Meredith Source Chapter 19 of – Shiffman, D. (2008). Learning Processing. Morgan Kaufmann, Burlington, MA. ISBN:
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae david streader, VUW Echo Networking COMP
Lewis Benge. // using Windows.Networking; // using Windows.Networking.Sockets; var socket = new StreamSocket(); var hostName = new HostName("example.com");
private void Goto2(object sender, Windows.UI.Xaml.RoutedEventArgs e) { var app = App.Current as Common.BootStrapper; var nav = app.NavigationService;
Joe Hummel, PhD Microsoft MVP Visual C++ Technical Staff: Pluralsight, LLC Professor: U. of Illinois, Chicago stuff:
WHO WILL BENEFIT FROM THIS TALK TOPICS WHAT YOU’LL LEAVE WITH Developers Interested in HTML5 Games Interested in Windows Azure Interested in Game Development.
Introduction to Socket Programming in Android Jules White Bradley Dept. of Electrical and Computer Engineering Virginia Tech
Code reading skills LEVEL GAME.  Skeleton has error messages.  Notice the red lines on right slider. Click… you’ll go to an error.  pieces = levels.getPieces();
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Networking COMP # 22.
Networks Sockets and Streams. TCP/IP in action server ports …65535 lower port numbers ( ) are reserved port echo7 time13 ftp20 telnet23.
Connectionless Sockets SWE 344 Internet Protocols & Client Server Programming.
33% Multi-screened while gaming 1 6 v.
CS390- Unix Programming Environment CS 390 Unix Programming Environment Java Socket Programming.
WHO WILL BENEFIT FROM THIS TALK TOPICS WHAT YOU’LL LEAVE WITH ASP.NET developers, including Web Forms & MVC History of async programming in.NET How async.

web app-to-app picking downloaded files.
IAsyncResult ar = BeginSomething(…); // Do other work, checking ar.IsCompleted int result = EndSomething(ar);
Socket Programming Lab 1 1CS Computer Networks.
12/5/2015.net 1 system.net Contains any network functionallity you would need in c# Several sub namespaces exists to allow for more fined control –System.Net.Sockets.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology SDL_net Client-Server Example Spring 2012.
 AJAX – Asynchronous JavaScript and XML  Ajax is used to develop fast dynamic web applications  Allows web pages to be updated asynchronously by transferring.
TCP/IP Protocol Stack IP Device Drivers TCPUDP Application Sockets (Gate to network) TCP: –Establish connection –Maintain connection during the communication.
Tutorial 2 Introduction to Android App Development Course: Network Protocols (NETW703) Department of Networks Faculty of Information Engineering and Technology.
Integral Users will interact with your app on a big screen with keyboard and mouse.
App Package Folder App data Folders Local Roaming Temp Removable Storage (SD Card) Cloud Credential Locker B/ground Transfer Publishers Shared Folder.
Top Problem Areas Suspend/resume Terminate/restart Client updates Network connectivity Asynchronous code Resolutions and orientation Device testing.
APLIKACIJE KOJE SU IZVAN SEBE Domagoj Pavlešić, dizzy.hr.
C# Present and Future Marita Paletsou Software Engineer.
Vaughan Knight App Ecosystem Lead Microsoft FileOpenPicke r, FileSavePicker Read/Write access to SD card Appointments /Calendar API enhancements Appointments.
USING ANDROID WITH THE INTERNET. Slide 2 Lecture Summary Getting network permissions Working with the HTTP protocol Sending HTTP requests Getting results.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae david streader, VUW Echo Networking COMP
App Peripherals CAN BILGIN, Authority Partners Inc.
Assignment 3 A Client/Server Application: Chatroom
Windows Calls Applications (windows.applicationmodel.calls)
Echo Networking COMP
Windows Developer Day Fall Creators Update Chris Cortes
PRESENTED To: Sir Abid………. PRESENTED BY: Insharah khan………. SUBJECT:
12 Asynchronous Programming
Web Service.
03 | Async Programming & Networking Intro
Presentation transcript:

PeerFinder.Role = PeerRole.Client; PeerFinder.Role = PeerRole.Host;

PeerFinder Networking Model Host Client

PeerFinder HostClient PeerFinder.Role = PeerRole.Client; PeerFinder.ConnectionRequested += ConnectionRequested; PeerFinder.TriggeredConnectionStateChanged += TriggeredConnectionStateChanged; PeerFinder.Start(); PeerFinder.Role = PeerRole.Host; PeerFinder.TriggeredConnectionStateChanged += TriggeredConnectionStateChanged; PeerFinder.Start();

Finding players HostClient PeerFinder.Role = PeerRole.Client; PeerFinder.Start(); // Wait for Host to find and invite client. private async void FindPeers() { progressBar.Visibility = Visibility.Visible; try { var peerInfoCollection = await PeerFinder.FindAllPeersAsync(); if (peerInfoCollection.Count > 0) { // Display nearby clients in a list...

Connecting players HostClient – incoming connection request private async void ConnectionRequested(object sender, ConnectionRequestedEventArgs e) { List existingInvitations = new List (); existingInvitations.Add(e.PeerInformation.DisplayName);... ReceivedInvitationsHeader.Text = "STOMP invitations :-)"; progressBar.Visibility = Visibility.Collapsed; } private async Task ConnectToPeers(PeerInformation peer) { progressBar.Visibility = Visibility.Visible; StreamSocket s = await PeerFinder.ConnectAsync(peer); ConnectedPeer temp = new ConnectedPeer(peer.DisplayName); connectedPeers[temp] = new SocketReaderWriter(s, this);... startGameButton.Visibility = Visibility.Visible; }

Connecting players (continued) HostClient – connect devices // Navigate client to a new page - WaitingForHost... { backButton.Visibility = Visibility.Collapsed; WaitingForHostParameters parameters = (WaitingForHostParameters)navigationParameter; StreamSocket socket = await PeerFinder.ConnectAsync(parameters.peer); pageTitle.Text = "Connected! Waiting for Host...";... } // Host connecting to client...

ConnectedPlayers.Items.Add(peer.DisplayName);

Tap and connect HostClient – connect devices private async void TriggeredConnectionStateChanged(object sender, TriggeredConnectionStateChangedEventArgs e) { if (e.State == TriggeredConnectState.PeerFound) { // Show indeterminate progress UI } else if (e.State == TriggeredConnectState.Completed) { StreamSocket socket = e.Socket; WaitForHost(socket); } else if (e.State == TriggeredConnectState.Failed) { // Inform challenger that connection failed } private async void TriggeredConnectionStateChanged(object sender, TriggeredConnectionStateChangedEventArgs e) { if (e.State == TriggeredConnectState.PeerFound) { // Show indeterminate progress UI } else if (e.State==TriggeredConnectState.Completed) { socket = new SocketReaderWriter(e.Socket, this); } else if (e.State == TriggeredConnectState.Failed) { // Inform Game Leader that connection failed }

Sending/Receiving data - timer HostClient public async void ReadMessage() { // Read incoming message from the socket uint bytesRead = await dataReader.LoadAsync(sizeof(uint)); uint messageLength = dataReader.ReadUInt32(); bytesRead = await dataReader.LoadAsync(messageLength); currentMessage = dataReader.ReadString(messageLength);... } private int ParseMessage() {... case Constants.OpCodeUpdateClientTime: if (gamePage != null) gamePage.UpdateClientTime(words[1]); break; private void UpdateTime(TickOption option) { // Decrement the timer by 1 second foreach (SocketReaderWriter tempsocket in connectedPeers.Values) { string message = string.Format( "{0} {1}", Constants.OpCodeUpdateClientTime, tempsocket.WriteMessage(message); } }