|
From: Hart's A. <bha...@ya...> - 2011-02-02 02:51:01
|
I'm having some problems getting a basic server running, hoping someone with more vnc experience than me can give me some clues what i might be doing wrong.thanks requires: http://pastebin.com/Jn9rg3uU script crashes after client connects, client shows blank screen for one second before server segfaults.server iterates 5 times before crash. tested on ubuntu10.10 is this incorrect? array = ctypes.create_string_buffer( '\1\2\3\4'*WIDTH*HEIGHT ) serverPtr.contents.frameBuffer = ctypes.cast( array, ctypes.c_char_p ) $ python ctypes_vnc_server.py<ctypeslibs.rfb.rfb._rfbScreenInfo object at 0x7f4d10008290>02/02/2011 10:25:21 Listening for VNC connections on TCP port 5900('framebuffer contents', 1228800)('expected length', 1228800)02/02/2011 10:25:28 Got connection from client 127.0.0.102/02/2011 10:25:28 other clients:02/02/2011 10:25:28 Client Protocol Version 3.802/02/2011 10:25:28 Protocol version sent 3.8, using 3.802/02/2011 10:25:28 rfbProcessClientSecurityType: executing handler for type 102/02/2011 10:25:28 rfbProcessClientSecurityType: returning securityResult for client rfb version >= 3.802/02/2011 10:25:29 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFFFEFE)02/02/2011 10:25:29 Enabling NewFBSize protocol extension for client 127.0.0.102/02/2011 10:25:29 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0x574D5669)02/02/2011 10:25:29 Enabling full-color cursor updates for client 127.0.0.102/02/2011 10:25:29 Enabling X-style cursor updates for client 127.0.0.102/02/2011 10:25:29 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFFFEFF)02/02/2011 10:25:29 Using tight encoding for client 127.0.0.1updatedupdatedupdatedupdatedupdatedSegmentation fault script on pastebin:http://pastebin.com/mqFSq85n ############ script ########### import os,sys, time if '..' not in sys.path: sys.path.append( '..' )try: from ctypeslibs.rfb.rfb import *except: from rfb import * #print( dir() )WIDTH = 640HEIGHT = 480 serverPtr = rfbGetScreen( ctypes.pointer(ctypes.c_int(0)), ctypes.pointer( ctypes.c_char_p('')), WIDTH, HEIGHT, 8, 3, 4 )server = serverPtr.contentsprint(server)server.alwaysShared = ctypes.c_int(1) chararray = ctypes.c_char *(WIDTH*HEIGHT*4)#array = chararray() # this also works#array = ctypes.create_string_buffer( WIDTH*HEIGHT*4 )#array = ctypes.create_string_buffer( '\1'*WIDTH*HEIGHT*4 )array = ctypes.create_string_buffer( '\1\2\3\4'*WIDTH*HEIGHT ) serverPtr.contents.frameBuffer = ctypes.cast( array, ctypes.c_char_p ) try: rfbInitServer( serverPtr )except: rfbInitServerWithPthreadsAndZRLE( serverPtr ) print( 'framebuffer contents', len(serverPtr.contents.frameBuffer) )print( 'expected length', WIDTH*HEIGHT*4 ) ticks = 0while rfbIsActive(serverPtr): #print('ticks', ticks) #rfbMarkRectAsModified(serverPtr,0,0,WIDTH,HEIGHT) #usec = server.deferUpdateTime * 1000 updated = rfbProcessEvents( serverPtr, 1000 ) if updated: print('updated') ticks += 1 rfbShutdownServer( serverPtr, 1 ) |