Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33994

Re: please help me to debud my local chat network program

References <8edb652f-c48f-4758-a315-3ecc8070267d@googlegroups.com>
Date 2012-11-28 15:03 +1100
Subject Re: please help me to debud my local chat network program
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.328.1354075385.29569.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Nov 28, 2012 at 1:50 PM, Minh Dang <dangbaminh.it@gmail.com> 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 <module>
> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

please help me to debud my local chat network program Minh Dang <dangbaminh.it@gmail.com> - 2012-11-27 18:50 -0800
  Re: please help me to debud my local chat network program Terry Reedy <tjreedy@udel.edu> - 2012-11-27 22:48 -0500
  Re: please help me to debud my local chat network program Chris Angelico <rosuav@gmail.com> - 2012-11-28 15:03 +1100
    Re: please help me to debud my local chat network program Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-11-28 21:12 +0000
      Re: please help me to debud my local chat network program Minh Dang <dangbaminh.it@gmail.com> - 2012-11-28 18:48 -0800
  Re: please help me to debud my local chat network program Minh Dang <dangbaminh.it@gmail.com> - 2012-11-27 21:47 -0800
    Re: please help me to debud my local chat network program Chris Angelico <rosuav@gmail.com> - 2012-11-28 17:33 +1100
  Re: please help me to debud my local chat network program Minh Dang <dangbaminh.it@gmail.com> - 2012-11-28 02:52 -0800
    Re: please help me to debud my local chat network program Chris Angelico <rosuav@gmail.com> - 2012-11-28 22:16 +1100
      Re: please help me to debud my local chat network program Minh Dang <dangbaminh.it@gmail.com> - 2012-11-28 03:17 -0800
      Re: please help me to debud my local chat network program Minh Dang <dangbaminh.it@gmail.com> - 2012-11-28 03:17 -0800
  Re: please help me to debud my local chat network program Minh Dang <dangbaminh.it@gmail.com> - 2012-11-28 03:10 -0800
    Re: please help me to debud my local chat network program Chris Angelico <rosuav@gmail.com> - 2012-11-28 22:17 +1100
  Re: please help me to debud my local chat network program Minh Dang <dangbaminh.it@gmail.com> - 2012-11-28 03:23 -0800
  Re: please help me to debud my local chat network program Minh Dang <dangbaminh.it@gmail.com> - 2012-11-28 03:57 -0800
    Re: please help me to debud my local chat network program Chris Angelico <rosuav@gmail.com> - 2012-11-28 23:24 +1100
      Re: please help me to debud my local chat network program Minh Dang <dangbaminh.it@gmail.com> - 2012-11-28 06:10 -0800
        Re: please help me to debud my local chat network program Chris Angelico <rosuav@gmail.com> - 2012-11-29 01:21 +1100
          Re: please help me to debud my local chat network program Minh Dang <dangbaminh.it@gmail.com> - 2012-11-28 07:27 -0800
          Re: please help me to debud my local chat network program Minh Dang <dangbaminh.it@gmail.com> - 2012-11-28 07:27 -0800
      Re: please help me to debud my local chat network program Minh Dang <dangbaminh.it@gmail.com> - 2012-11-28 06:10 -0800
  Re: please help me to debud my local chat network program Minh Dang <dangbaminh.it@gmail.com> - 2012-11-29 01:03 -0800
    Re: please help me to debud my local chat network program Chris Angelico <rosuav@gmail.com> - 2012-11-29 20:13 +1100
    RE: please help me to debud my local chat network program "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-30 20:11 +0000

csiph-web