source: galcon-client/src/com/example/helloandroid/ClientThread.java@ 3a0d468

Last change on this file since 3a0d468 was 3a0d468, checked in by dportnoy <devnull@…>, 14 years ago

Added code to connect to the game server.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1package com.example.helloandroid;
2
3/*
4 * This thread is responsible for interacting with the server. It waits to receive messages from the server and then handles them.
5 */
6
7public class ClientThread extends Connection {
8 private Game main;
9
10 public ClientThread(String ip, int port, Game main) {
11 super(ip, port, "ClientThread");
12
13 this.main = main;
14 }
15
16 protected void processMessage(MessageType type, String input) {
17
18 }
19
20 protected void connectionStart() {
21 main.mThread.connMessage = "Connection Started";
22 }
23
24 protected void connectionSuccess() {
25 main.mThread.connMessage = "Connected to Server";
26 sendMessage(MessageType.Info, "Yo, youze beeze gay!");
27 }
28
29 protected void connectionFailure(String str) {
30 main.mThread.connMessage = "Server not found";
31 main.mThread.connMessage = str;
32 }
33
34 protected void connectionBreak() {
35 main.mThread.connMessage = "Your connection was interrupted";
36 }
37
38 protected void peerDisconnect() {
39 main.mThread.connMessage = "The server disconnected";
40 }
41
42 protected void connectionEnd() {
43
44 }
45}
Note: See TracBrowser for help on using the repository browser.