[issue18095] unable to invoke socket.connect with AF_UNSPEC

2013-07-06 Thread Martin Gergov

Martin Gergov added the comment:

--- a/Modules/socketmodule.cTue Jul 02 09:07:53 2013 -0400
+++ b/Modules/socketmodule.cSat Jul 06 21:08:40 2013 +0300
@@ -3673,6 +3673,15 @@
 {
 int how;
 int res;
+struct sockaddr_in sin;
+if (s-sock_type == SOCK_DGRAM){
+memset((char *)sin, 0, sizeof(sin));
+sin.sin_family = AF_UNSPEC;
+Py_BEGIN_ALLOW_THREADS
+res = connect(s-sock_fd, (struct sockaddr *)sin, sizeof(sin));
+Py_END_ALLOW_THREADS
+return Py_None;
+}
 
 how = _PyLong_AsInt(arg);
 if (how == -1  PyErr_Occurred())


The shutdown method seems a suitable candidate, but a disconnect() method(which 
is semantically more correct) could be introduced.

--
nosy: +marto1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18095
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18095] unable to invoke socket.connect with AF_UNSPEC

2013-07-06 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18095
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18095] unable to invoke socket.connect with AF_UNSPEC

2013-05-29 Thread Roman Valov

New submission from Roman Valov:

There is a way to disconnect UDP socket
that was previously connected to specific
remote endpoint in C:

  struct sockaddr_in sin;
  memset((char *)sin, 0, sizeof(sin));
  sin.sin_family = AF_UNSPEC;
  connect(fd, (struct sockaddr *)sin, sizeof(sin));

However in this is not available in python, since connect
accepts only (host, port) as a parameter for UDP socket.

It's possible to drop port connection with port=0,
however I can't find a way to drop host connection.

--
components: IO
messages: 190308
nosy: Roman.Valov
priority: normal
severity: normal
status: open
title: unable to invoke socket.connect with AF_UNSPEC
type: behavior
versions: Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18095
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com