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


Groups > comp.lang.python > #94571

Re: UDP and Python2.7 and 2.7 documentation gives error!

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 <lac@openend.se>
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 "Stéphane Wirtel" <stephane@wirtel.be>
cc Nils <nils@meditalk.com>, python-list@python.org, lac@openend.se
From Laura Creighton <lac@openend.se>
Subject Re: UDP and Python2.7 and 2.7 documentation gives error!
In-Reply-To Message from "Stéphane Wirtel" <stephane@wirtel.be> of "Sat, 25 Jul 2015 19:43:45 +0200." <E186D29E-702E-4EDB-A307-D8493AC9FB80@wirtel.be>
References <55B3C31D.7000205@meditalk.com><E186D29E-702E-4EDB-A307-D8493AC9FB80@wirtel.be>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.992.1437847690.3674.python-list@python.org> (permalink)
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

Show key headers only | View raw


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 
>> <module>
>>     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

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


Thread

Re: UDP and Python2.7 and 2.7 documentation gives error! Laura Creighton <lac@openend.se> - 2015-07-25 20:08 +0200

csiph-web