def goWaitForConnection(isHost, ipAddress, mapS=None): tryAgain = True while tryAgain: tryAgain = False if isHost: p = netserver.NetThread() else: p = netclient.NetThread(ipAddress) p.start() while not m.either(): proceedMulti(clock) if not p.isAlive(): if p.flag == "success": m.advanceNow = True else: m.backNow = True if m.back(): prev = m.phase m.changePhase(5) m.reset() while not m.advance(): proceedMulti(clock) if m.menu.value() == 1: tryAgain = True m.changePhase(prev) m.reset() elif m.advance(): if isHost: netcode.updateSend(p.net.conn, mapS) else: mapS = netcode.updateRecv(p.net.s, 2) theMap = gamemap.getMap(mapS) goCharacterSelection(p.net, isHost)
def transferPregameData(self, playerChars, expected): enemyData = [] for i in range(expected): inMsg = netcode.updateRecv(self.s, CHARACTER_TRANSFER_NET_MESSAGE_SIZE) enemyData.append(inMsg) for i in playerChars: netcode.updateSend(self.s, i.getTextString(True)) return mapchar.convertNetData(enemyData, 0)
def update(self, outMsg, msgSize=None): inMsg = netcode.updateRecv(self.s, msgSize) netcode.updateSend(self.s, outMsg) return inMsg, 1
def update(self, outMsg, msgSize=None): netcode.updateSend(self.conn, outMsg) inMsg = netcode.updateRecv(self.conn, msgSize) return inMsg, 2