Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newsgate.cistron.nl!newsgate.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; 'context': 0.05; '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; 'subject:2.7': 0.09; 'wrong,': 0.09; 'example:': 0.10; 'subject:error': 0.11; '2.7': 0.13; '(but': 0.15; 'server,': 0.15; '>on': 0.16; '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; '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; 'sock': 0.16; 'stephane': 0.16; 'wrote:': 0.16; 'laura': 0.18; '2015': 0.20; 'cc:addr:python.org': 0.20; 'cc:2**2': 0.20; 'skip:" 40': 0.20; 'trying': 0.22; 'sat,': 0.23; 'import': 0.24; '(most': 0.24; 'header:In-Reply-To:1': 0.24; 'script': 0.25; "doesn't": 0.26; 'skip:" 20': 0.26; 'error': 0.27; '+0200,': 0.27; 'subject:skip:d 10': 0.27; 'url:moin': 0.27; 'function': 0.28; "skip:' 10": 0.28; '13,': 0.29; 'correct,': 0.29; 'python2.7': 0.29; 'received:se': 0.29; 'understand,': 0.29; 'cc:no real name:2**1': 0.29; 'print': 0.30; 'url:wiki': 0.30; 'skip:g 30': 0.30; 'url:python': 0.33; 'traceback': 0.33; 'file': 0.34; 'gives': 0.35; 'so,': 0.35; 'but': 0.36; 'too': 0.36; 'url:org': 0.36; 'subject:: ': 0.37; 'things': 0.38; 'doing': 0.38; 'listing': 0.38; 'where': 0.40; 'still': 0.40; 'address': 0.61; 'header:Message-Id:1': 0.61; 'course.': 0.67; '8bit%:100': 0.70; 'internet': 0.70; 'jul': 0.72; 'received:89': 0.80; 'sorry.': 0.91 To: "=?utf-8?q?St=C3=A9phane?= Wirtel" cc: Nils , 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 "=?utf-8?q?St=C3=A9phane?= Wirtel" of "Sat, 25 Jul 2015 19:43:45 +0200." References: <55B3C31D.7000205@meditalk.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <31338.1437847681.1@fido> Content-Transfer-Encoding: 8bit Date: Sat, 25 Jul 2015 20:08:01 +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 20:08:04 +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: 52 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1437847690 news.xs4all.nl 2916 [2001:888:2000:d::a6]:40328 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:94571 In a message of Sat, 25 Jul 2015 19:43:45 +0200, "Stéphane Wirtel" writes: >the bind function is for the server, not for the client. > >here is an example: https://wiki.python.org/moin/UdpCommunication > >Stephane >On 25 Jul 2015, at 19:10, Nils wrote: > >> 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 Stephane is correct, of course. I read things too superficially, sorry. (but if ipcpnfig doesn't find it, you will still have this problem:) Laura