package com.example.wificommunication_server;

import java.io.BufferedReader;

import android.os.Message;

public class ReceiveMessage {
	public static BufferedReader bufferFromServer	= null;
	private static String content;
	public static void receiveMessage(){
			try{
				if((content = bufferFromServer.readLine()) != null){
					ServerActivity.clientMessage = content;				
					if(content.equals("Reboot")){
						bufferFromServer.close();
						SendMessage.bufferToServer.close();
						MyThread.mSocketServer.close();
						MyThread.mSocketServer = null;
					}							
					Message receiveMeg = new Message();
					receiveMeg.what = 1;
					ServerActivity.mHandler.sendMessage(receiveMeg);
				}
			}catch(Exception e){
				ServerActivity.serverMessage = "接收异常:" + e.getMessage() ;//消息换行
				Message exceptionMsg = new Message();
				exceptionMsg .what = 0;
				ServerActivity.mHandler.sendMessage(exceptionMsg);
				return;
			}
	}		
}