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


Groups > comp.lang.python > #94565

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

Return-Path <stephane@wirtel.be>
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; 'subject:2.7': 0.09; 'wrong,': 0.09; 'example:': 0.10; 'subject:error': 0.11; '2.7': 0.13; 'server,': 0.15; '@matrixise': 0.16; 'bind': 0.16; 'from:addr:stephane': 0.16; 'from:addr:wirtel.be': 0.16; 'from:name:st\xc3\xa9phane': 0.16; 'from:name:wirtel': 0.16; 'message-id:@wirtel.be': 0.16; 'received:192.168.59': 0.16; 'received:192.168.59.3': 0.16; 'received:mx1.wirtel.be': 0.16; 'received:wirtel.be': 0.16; 'sock': 0.16; 'stephane': 0.16; 'st\xc3\xa9phane': 0.16; 'url:wirtel': 0.16; 'wirtel': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'skip:" 40': 0.20; 'trying': 0.22; 'cc:no real name:2**0': 0.22; 'import': 0.24; '(most': 0.24; 'header:In-Reply-To:1': 0.24; 'script': 0.25; 'skip:" 20': 0.26; 'error': 0.27; 'subject:skip:d 10': 0.27; 'url:moin': 0.27; 'function': 0.28; "skip:' 10": 0.28; '13,': 0.29; 'python2.7': 0.29; 'understand,': 0.29; 'print': 0.30; 'url:wiki': 0.30; 'url:mailman': 0.30; 'received:be': 0.30; 'skip:g 30': 0.30; 'url:python': 0.33; 'traceback': 0.33; 'url:listinfo': 0.34; 'file': 0.34; 'gives': 0.35; 'so,': 0.35; 'but': 0.36; 'url:org': 0.36; 'subject:: ': 0.37; 'doing': 0.38; 'listing': 0.38; 'received:192': 0.39; 'url:mail': 0.40; 'where': 0.40; 'address': 0.61; 'received:176': 0.66; 'here': 0.66; '8bit%:100': 0.70; 'internet': 0.70; 'jul': 0.72; 'received:176.31': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=simple/simple; d=wirtel.be; s=default; t=1437845879; bh=xZksqldGJ21uFrbWvyufbirq/s7/Vyzw7jedfmGK5UU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=sq1UyftXzE+DDnew3FF9+jwAmI5o6PsYaW6Lq2k9IJGefTnvjeG4C8uX7fgVP6fYk t3y44g6De8JNIUjK7eRNn9GBrFWa2vorLpsI4tKHVoRnfkelkQDFS06zpQUmfOsqRz VM3PJ+qoLKbctOb5XyZnlh5FBn6h6E3WJMb76BMgmxtXXZciQxe4ptVQv24hXSf8VS v/qwBLmVSU0m2TkLRvaFOKooWHEOP5b7Q0kS6u7fF7cjAYTNyEDoN0vOrJdfcP+lzo cKQrEirYqH3yHbf7JqdGxE2pIsPF9qozqnWLUEjeoP5lK9h1NvRu0R6R6GKAJDaYwp I7lchr6zKTcIQ==
From "Stéphane Wirtel" <stephane@wirtel.be>
To Nils <nils@meditalk.com>
Cc python-list@python.org
Subject Re: UDP and Python2.7 and 2.7 documentation gives error!
Date Sat, 25 Jul 2015 19:43:45 +0200
In-Reply-To <55B3C31D.7000205@meditalk.com>
References <55B3C31D.7000205@meditalk.com>
MIME-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
X-Mailer MailMate (1.9.2r5107)
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.988.1437846233.3674.python-list@python.org> (permalink)
Lines 59
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1437846233 news.xs4all.nl 2931 [2001:888:2000:d::a6]:51980
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 5237
X-Received-Body-CRC 3512055360
Path csiph.com!usenet.pasdenom.info!news.stben.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!bcyclone01.am1.xlned.com!bcyclone01.am1.xlned.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:94565

Show key headers only | View raw


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
>
> --
>
>
>
>
>
> -- 
> https://mail.python.org/mailman/listinfo/python-list


--
Stéphane Wirtel - http://wirtel.be - @matrixise

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


Thread

Re: UDP and Python2.7 and 2.7 documentation gives error! "Stéphane Wirtel" <stephane@wirtel.be> - 2015-07-25 19:43 +0200
  Re: UDP and Python2.7 and 2.7 documentation gives error! Grant Edwards <invalid@invalid.invalid> - 2015-07-26 01:01 +0000

csiph-web