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


Groups > comp.lang.python > #27598

Re: How to set the socket type and the protocol of a socket using create_connection?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
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; 'socket': 0.05; 'assign': 0.07; 'space.': 0.07; 'subject:skip:c 10': 0.07; 'subject:How': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'sockets': 0.09; 'subject:set': 0.09; 'subject:using': 0.09; 'aug': 0.13; 'receives': 0.13; 'stack': 0.15; '(link': 0.16; '1))': 0.16; 'as- is': 0.16; 'follow-up': 0.16; 'headers.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'socket.': 0.16; 'subject:type': 0.16; 'url:linux': 0.16; 'later': 0.16; 'module': 0.19; 'sends': 0.22; 'struct': 0.22; 'work.': 0.23; 'header': 0.24; 'pass': 0.25; 'implemented': 0.27; 'raw': 0.27; "doesn't": 0.28; 'header:X-Complaints-To:1': 0.28; 'implies': 0.29; 'protocols': 0.29; 'source': 0.29; 'probably': 0.29; 'error': 0.30; 'could': 0.32; 'url:home': 0.33; 'anyone': 0.33; 'to:addr:python-list': 0.33; "can't": 0.34; 'subject:?': 0.35; 'something': 0.35; 'received:org': 0.36; 'but': 0.36; 'charset:us-ascii': 0.36; 'does': 0.37; 'level': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'build': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'address': 0.60; 'skip:u 10': 0.60; 'link': 0.60; "you'll": 0.62; 'worth': 0.63; 'address,': 0.79; 'contents,': 0.84; 'address;': 0.91; 'dennis': 0.91; 'tied': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: How to set the socket type and the protocol of a socket using create_connection?
Date Tue, 21 Aug 2012 22:10:43 -0400
Organization > Bestiaria Support Staff <
References <cbafe578-0a1a-4d0b-82a5-54c9f84fcd67@googlegroups.com> <4edc5ccb-9121-47b0-8ad4-2bf106735532@googlegroups.com> <50323dc7$0$6841$e4fe514c@news2.news.xs4all.nl> <c8381655-3c9a-4100-81af-bcd3f07414f0@googlegroups.com> <mailman.3568.1345483663.4697.python-list@python.org> <7e4fbbae-a70f-42fc-82c9-a03f1a118136@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host adsl-76-249-27-81.dsl.klmzmi.sbcglobal.net
X-Newsreader Forte Agent 3.3/32.846
X-No-Archive YES
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3623.1345601437.4697.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1345601437 news.xs4all.nl 6844 [2001:888:2000:d::a6]:38342
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:27598

Show key headers only | View raw


On Tue, 21 Aug 2012 10:00:28 -0700 (PDT), Guillaume Comte
<guillaume.comte10@gmail.com> declaimed the following in
gmane.comp.python.general:

	A later follow-up
> Unfortunatly, my_socket.bind((src_addr, 1)) doesn't work. I get the error message: "socket.error: [Errno 49] Can't assign requested address"...
> 

	Since .bind() is used to set up a /listener/, the network stack
(LINK layer) probably has to be tied to the IP address; that is, a valid
"source" address needs to be supplied to .bind.


> But when I try to set a source address, I still get the same error message...
> 
> Does anyone know how I could build the IP header (I don't even know if it can be the solution but it's worth a try...)?

	Based upon http://linux.die.net/man/7/raw "Raw sockets allow new
IPv4 protocols to be implemented in user space. A raw socket receives or
sends the raw datagram not including link level headers. " implies that
you need to build the entire IP packet for your ICMP message... That
means you do NOT use socket methods to set fields -- you'll probably
have to use something like the struct module to lay out the entire IP
packet /including/ header contents, and then pass that as-is to the
socket.

-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


Thread

How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-20 02:14 -0700
  Re: How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-20 05:36 -0700
    Re: How to set the socket type and the protocol of a socket using create_connection? Hans Mulder <hansmu@xs4all.nl> - 2012-08-20 15:38 +0200
      Re: How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-20 08:04 -0700
        Re: How to set the socket type and the protocol of a socket using create_connection? Dave Angel <d@davea.name> - 2012-08-20 13:27 -0400
          Re: How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-21 10:00 -0700
          Re: How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-21 10:00 -0700
            Re: How to set the socket type and the protocol of a socket using create_connection? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-21 15:28 -0400
            Re: How to set the socket type and the protocol of a socket using create_connection? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-21 22:10 -0400
              Re: How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-22 00:29 -0700
              Re: How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-22 00:29 -0700
                Re: How to set the socket type and the protocol of a socket using create_connection? Hans Mulder <hansmu@xs4all.nl> - 2012-08-22 11:03 +0200
                Re: How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-22 02:21 -0700
      Re: How to set the socket type and the protocol of a socket using create_connection? Chris Angelico <rosuav@gmail.com> - 2012-08-21 01:38 +1000
  Re: How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-22 01:43 -0700
    Re: How to set the socket type and the protocol of a socket using create_connection? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-22 15:18 -0400
      Re: How to set the socket type and the protocol of a socket using create_connection? Grant Edwards <invalid@invalid.invalid> - 2012-08-23 13:53 +0000

csiph-web