All pastes #596097 Raw Edit

Miscellany

public text v1 · immutable
#596097 ·published 2007-06-29 20:06 UTC
rendered paste body
import 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'