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

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

Moved Connection and MessageType to galconcommon.

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