python - Program hanging, probably socket-based -


That's why I have called for sending in the main host program on 'host server it went got .py file it waits to connect "mode that is fine and dandy, except that if you pull it back and then it goes back, the program would freeze. # Data.host # Imported from Host Oz, Seiz, Pagmem #Basic stuff of Pigame.Local import with #MempoShop module * #Fiddley bits data gaffex import sockets import letters, flickr, backbutton, flickrandler import config Import Import Threading Import * def net_srv () by importing data as: # I do not have to ask, it is called global sock, connected sock = socket.socket (socket.AF_INET, socket.SOCK_STREAM) sock.bind (('', Port) see sock.listen (1); Connect = Incorrect class host screen (): def __init __ (self): Enter DRAF pass (self, customer): conf.state = conf.STATE_HOSTING size = (width, height) = [640,480] screen = pygame.display set_mode (size) Dt = 0.0 clock = pygame.time.Clock () background = pygame.Surface (screen.get_size ()) background = background. Convert () background .phil ((0, 0, 0)) font = pygame.font. Font (OS path.join ("data", "graphics", "lucon.TTF"), 11) text = font.reader ("Waiting for another player to connect.", 1, (255) , 255, 255)) Textpos = text.get_rect () textpos.center = background.get_rect (). Center textpos.centery - = 10 f = letter ( "F") L = letter ( "L") I = letter ( "I") C = letter ( "C") K = Letter ( "K") e = letters ("E") r = letter ("r") flicker = flickr () handler = flickrhandler () back = backbutton () allsprites2 = (f, l, i, c, k, e, r) clicks = [back] In allsprites2: s.update (1) s.rect.centery = s.rect.centery - 50 allsprites = pygame.sprite.LayeredDirty (allsprites2, flicker, clickable) flicker. Update (1) TimTaFlixer = 0.5 title switch = 0 net_srv () def connect (): global con, ADR, kenek Ted Cohn, Ader = sock.accept () Connected = True = Thread Threading. Thread (target = connect) thread Start () while 1: dt = (clock.tick (60) /1000.0) timetoFlicker - = dt pygame.display.set_caption ("Flickr% d fps"% clock.get_fps ()) events = pygame for event in events. Event.get (): If Event.type == pygame.QUIT: sys.exit () # x button works if event.type == MOUSEBUTTONDOWN: # to check if event.button == 1: Object For those who click in: if object.rect.collidepoint (pygame.mouse.get_pos ()) and object.clickCheck () == "back": flicker.update (1) timetoFlicker = 0.09 titleSwitch = 1 if connected : Returns (Conn, Eder, 'Server') Alif is not a thread .is_alive (): Flickr. Adapter (1) Timeto Ikar = 0.09 Shirshksvich = 1 if Taimentofliksr & lt; = 0: Timeto Flaker, Viz = Handler. Flickr) Flickr for the object in clicker. Adate (Viz): Object. Adate (V) if title switch & gt; 0 and VES == 0: Tymton Flickr = 0.02 alif titles switch & gt; 0: sock.close () Back to the wrong pygame.event.pump () If Flickr is not there. View: Screen. Blitte (text, text) react = allsprites.draw (screen) pygame.display.update (rects) pygame.display flip ()

Any ideas may be due to the bra?


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -