Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'msg': 0.07; 'socket': 0.07; 'cc:addr:python-list': 0.09; 'msg)': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'skip:> 40': 0.09; 'subject:2.7': 0.09; 'wrong,': 0.09; 'subject:error': 0.11; '2.7': 0.13; 'bind': 0.16; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'localhost': 0.16; 'message-id:@fido.openend.se': 0.16; 'received:89.233': 0.16; 'received:89.233.217': 0.16; 'received:89.233.217.133': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'laura': 0.18; '2015': 0.20; 'cc:addr:python.org': 0.20; 'skip:" 40': 0.20; 'cc:2**1': 0.22; 'not,': 0.22; 'trying': 0.22; 'sat,': 0.23; '(most': 0.24; 'header :In-Reply-To:1': 0.24; 'script': 0.25; 'skip:" 20': 0.26; 'error': 0.27; '+0200,': 0.27; 'subject:skip:d 10': 0.27; 'to?': 0.27; "skip:' 10": 0.28; '13,': 0.29; 'python2.7': 0.29; 'received:se': 0.29; 'understand,': 0.29; 'cc:no real name:2**1': 0.29; 'skip:g 30': 0.30; 'file': 0.34; 'gives': 0.35; 'skip:> 10': 0.35; 'something': 0.35; 'problem.': 0.35; 'subject:: ': 0.37; 'doing': 0.38; 'listing': 0.38; 'does': 0.39; 'where': 0.40; 'your': 0.60; 'address': 0.61; 'header:Message-Id:1': 0.61; 'internet': 0.70; 'jul': 0.72; '8bit%:98': 0.76; 'received:89': 0.80 To: nils@meditalk.com cc: python-list@python.org, lac@openend.se From: Laura Creighton Subject: Re: UDP and Python2.7 and 2.7 documentation gives error! In-Reply-To: Message from Nils of "Sat, 25 Jul 2015 19:10:53 +0200." <55B3C31D.7000205@meditalk.com> References: <55B3C31D.7000205@meditalk.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <30906.1437847014.1@fido> Content-Transfer-Encoding: 8bit Date: Sat, 25 Jul 2015 19:56:54 +0200 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [89.233.217.130]); Sat, 25 Jul 2015 19:56:56 +0200 (CEST) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 1437847023 news.xs4all.nl 2909 [2001:888:2000:d::a6]:34681 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:94569 In a message of Sat, 25 Jul 2015 19:10:53 +0200, Nils writes: >UDP and Python2.7 and 2.7 documentation gives error! >I am trying to send UDP messages from one PC to another, using P2.7. >BUT I get an error I do not understand, this as I am following the doc's >for Python2.7! Listing of the script with error result following: > >import socket > >UDP_IP = '192.168.0.90' >UDP_PORT = 45121 >msg = '7654321' > >print ("UDP target IP:", UDP_IP) >print ("UDP target port:", UDP_PORT) >print ("message:", msg) > >sock = socket.socket(socket.AF_INET, # Internet >                     socket.SOCK_DGRAM) # UDP >sock.bind((UDP_IP, UDP_PORT)) >sock.send( msg ) > > >C:\Utveckling\Counter_python>Counter_send.py >('UDP target IP:', '192.168.0.90') >('UDP target port:', 45121) >('message:', '7654321') >Traceback (most recent call last): >  File "C:\Utveckling\Counter_python\Counter_send.py", line 13, in >    sock.bind((UDP_IP, UDP_PORT)) >  File "C:\Python27\lib\socket.py", line 228, in meth >    return getattr(self._sock,name)(*args) >socket.error: [Errno 10049] The requested address is not valid in its >context > >C:\Utveckling\Counter_python> > >So, please tell me where I am doing wrong, or is doc's wrong?? >Nils in Uppsala Does ipconfig report that 192.168.0.90 is something you can bind to? If not, that is your problem. It needs to be something on localhost that you can bind to. Laura