1134 Networking: Streams-Based Sockets and Datagrams Chapter 22 (Medical web site)

1134 Networking: Streams-Based Sockets and Datagrams Chapter 22 98 protected void Client_Closing( 99 object sender, CancelEventArgs e ) 100 { 101 done = true; 102 } 103 104 // draws the mark of each square 105 public void PaintSquares() 106 { 107 Graphics g; 108 109 // draw the appropriate mark on each panel 110 for ( int row = 0; row < 3; row++ ) 111 for ( int column = 0; column < 3; column++ ) 112 { 113 // get the Graphics for each Panel 114 g = board[ row, column ].SquarePanel.CreateGraphics(); 115 116 // draw the appropriate letter on the panel 117 g.DrawString( board[ row, column ].Mark.ToString(), 118 this.Font, brush, 8, 8 ); 119 } 120 } // end method PaintSquares 121 122 // send location of the clicked square to server 123 protected void square_MouseUp( 124 object sender, System.Windows.Forms.MouseEventArgs e ) 125 { 126 // for each square check if that square was clicked 127 for ( int row = 0; row < 3; row++ ) 128 for ( int column = 0; column < 3; column++ ) 129 if ( board[ row, column ].SquarePanel == sender ) 130 { 131 CurrentSquare = board[ row, column ]; 132 133 // send the move to the server 134 SendClickedSquare( board[ row, column ].Location ); 135 } 136 } // end method square_MouseUp 137 138 // control thread that allows continuous update of the 139 // textbox display 140 public void Run() 141 { 142 // first get players's mark (X or O) 143 myMark = reader.ReadChar(); 144 idLabel.Text = "You are player "" + myMark + """; 145 myTurn = ( myMark == 'X' ? true : false ); 146 147 // process incoming messages 148 try 149 { Fig. 22.6 Fig. 22.FiFig. 22.6g. 22.6Client side of client/server Tic-Tac-Toe program. (Part 3 of 7.) Fig. 22.6
Note: In case you are looking for affordable webhost to host and run your web application check Vision http web server services

Leave a Reply