Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'explicitly': 0.04; 'context': 0.05; 'everybody,': 0.05; 'skip:" 60': 0.05; 'socket': 0.05; 'subject:help': 0.07; 'python': 0.09; 'bug': 0.10; '42,': 0.16; 'bind': 0.16; 'code?': 0.16; 'easier.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hmm.': 0.16; 'oserror:': 0.16; 'subject:program': 0.16; 'sure.': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'skip:u 30': 0.17; 'appropriate': 0.20; 'code.': 0.20; 'file.': 0.20; 'trying': 0.21; 'bit': 0.21; 'received:209.85.214.174': 0.21; 'tells': 0.22; 'this:': 0.23; "i've": 0.23; 'header:In-Reply-To:1': 0.25; '(most': 0.27; '(as': 0.27; 'subject:please': 0.27; 'message- id:@mail.gmail.com': 0.27; 'ball': 0.29; 'project:': 0.29; 'source': 0.29; 'probably': 0.29; 'seconds': 0.30; 'file': 0.32; 'extract': 0.33; 'much.': 0.33; 'traceback': 0.33; 'utility': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'done': 0.34; 'nov': 0.35; 'doing': 0.35; 'pm,': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'there': 0.35; 'skip:u 20': 0.36; 'but': 0.36; 'thank': 0.36; 'two': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'things': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'google': 0.39; 'header:Received:5': 0.40; 'help': 0.40; 'enable': 0.60; 'your': 0.60; 'address': 0.60; 'skip:u 10': 0.60; 'first': 0.61; 'mentioned': 0.63; 'more': 0.63; 'here': 0.65; 'broadcast': 0.65; 'sharing': 0.74; 'dang': 0.84; 'needed:': 0.84; 'sometimes.': 0.84; 'broadcasting': 0.91; 'lately,': 0.91; 'tricky': 0.91; 'subject:chat': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Z22cTzqC6xdetVZ+DAAyGUfyiQS3KHRJVDWV+lilm5g=; b=xtewx1XxNXNX0o4gdF9GiVvCWr1G0V9wDks4cvSfxLhAtoIOE/ZT9KqHmApA8qix9C dT4jxx9SLhBbrl2s6Qg41EpmIvmytc3ScS5YN5HX0docV3RjaIMreJzFowGRCag8z69O mNZk2xw868Mcvtr102j2wmScN9GIZ4aj7EtIa7lTw591NcSCDMWXC2jsgET40k9k5CPL Ew2oYziTM3IsRlz03DE13UVtTmdRnW/JWQx+R69A221YQk0659mEzvmIdVxZLJ7JXQ/G Ng0ZsvU8TFfBAu557YVhoCJn4wCJw0nM/w9XZT1Z6gHbDNhj+4ldVkxaWxZRFfgnOKrE 2z9A== MIME-Version: 1.0 In-Reply-To: <8edb652f-c48f-4758-a315-3ecc8070267d@googlegroups.com> References: <8edb652f-c48f-4758-a315-3ecc8070267d@googlegroups.com> Date: Wed, 28 Nov 2012 15:03:02 +1100 Subject: Re: please help me to debud my local chat network program From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 45 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1354075385 news.xs4all.nl 6913 [2001:888:2000:d::a6]:47493 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:33994 On Wed, Nov 28, 2012 at 1:50 PM, Minh Dang wrote: > Hello everybody, i am doing my project: local network chat using python > here is my file > http://www.mediafire.com/?cc2g9tmsju0ba2m Hmm. Might I recommend some other means of sharing your code? The unrar-free utility from the Debian repo won't extract more than the first file (accounts.txt), and I don't know if that's a problem with unrar-free or your file. A better-known format like zip or tar.gz would make things easier. > when i compile client.py, there is some bug > Traceback (most recent call last): > File "C:\Users\MINH_IT\workspace\project\src\project\pclient.py", line 303, in > sys.exit(main()) > File "C:\Users\MINH_IT\workspace\project\src\project\pclient.py", line 42, in main > servIP = broadcast() > File "C:\Users\MINH_IT\workspace\project\src\project\pclient.py", line 79, in broadcast > udpSock.bind((broadcastIP, broadcastPort)) > OSError: [WinError 10049] The requested address is not valid in its context > Please help me to debud it, thank so much. What's the broadcastIP address you're using? (As mentioned above, I can't see your source code.) Is it the appropriate address for one of your interfaces? Broadcast UDP is a bit tricky sometimes. You need to explicitly enable broadcasting on the socket - I've not done this in Python but two seconds with Google suggests that this is needed: udpSock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) You may have already done this, but I don't know without seeing your code. My crystal ball tells me that you're trying to bind to a broadcast address (eg 192.168.0.255). This is incorrect; you need to instead bind to your own IP address (eg 192.168.0.17). You can probably just do this: udpSock.bind(('', broadcastPort)) However, my crystal ball has been playing up a bit lately, so it's hard to be sure. ChrisA