Miscellany
public text v1 · immutableimport GameLogic
import socket
# reference to main object
O = GameLogic.getCurrentController().getOwner()
# if server is not connected
if O.Conectado == 0:
# computer name and port number
host = ''
port = 50007
# socket for protocol UDP
GameLogic.conn = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
GameLogic.conn.bind((host, port))
# set socket to nonblocking mode
GameLogic.conn.setblocking(0)
# server is connected to client
O.Conectado = 'TRUE'