Package com.svanloon.game.wizard.network

Examples of com.svanloon.game.wizard.network.MessageSender


*/
public class ServerCommandListener implements Runnable {

  public void run() {
    try {
      ms = new MessageSender(this.port);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
View Full Code Here


*/
public class ServerGameEventListener implements GameEventListener, Runnable {

  public void run() {
    try {
      this.ems = new MessageSender(port);
    } catch (IOException e) {
      e.printStackTrace();
      return;
    }
  }
View Full Code Here

    return msg;
  }

  private String getName(int id, int eventPort, int commandPort, int messengerPort, GameOptions pGo) {
    _logger.info("waiting on port " + initialConnectionPort);
    MessageSender ms = null;
    try {
      while(true) {
        try {
          ms = new MessageSender(initialConnectionPort);
          Message msg = createGetNameMessage(id, eventPort, commandPort, messengerPort, pGo);
          Message response = ms.sendMessageAndGetResponse(msg);
          for(MessageParam mp :response.getMsgParams()) {
            if(mp.getName().equals(MessageParamConstants.PLAYER_NAME)) {
              return mp.getValue();
            }
          }
        } catch (BindException be) {
          System.gc();
          try {
            Thread.sleep(500);
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
          continue;
        } catch (IOException e) {
          e.printStackTrace();
          return "ERROR " + eventPort;
        }
      }
    } finally {
      if(ms != null) {
        ms.close();
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.svanloon.game.wizard.network.MessageSender

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.