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


Groups > comp.lang.python > #94565 > unrolled thread

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

Started by"Stéphane Wirtel" <stephane@wirtel.be>
First post2015-07-25 19:43 +0200
Last post2015-07-26 01:01 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

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

From"Stéphane Wirtel" <stephane@wirtel.be>
Date2015-07-25 19:43 +0200
SubjectRe: UDP and Python2.7 and 2.7 documentation gives error!
Message-ID<mailman.988.1437846233.3674.python-list@python.org>
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

[toc] | [next] | [standalone]


#94584

FromGrant Edwards <invalid@invalid.invalid>
Date2015-07-26 01:01 +0000
Message-ID<mp1bgp$5ln$2@reader1.panix.com>
In reply to#94565
On 2015-07-25, =?utf-8?q?St=C3=A9phane?= Wirtel <stephane@wirtel.be> wrote:

> the bind function is for the server, not for the client.

It's for both.  When you're sending, it is used to specify the source
port.

--
Grant

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web