Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:: [': 0.04; '"""': 0.07; 'socket': 0.07; 'imported': 0.09; 'subject:trying': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'modul': 0.16; 'nameerror:': 0.16; 'subject:] ': 0.20; 'import': 0.22; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'replace': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'file': 0.32; '(most': 0.33; 'skip:# 10': 0.33; 'skip:s 30': 0.35; 'but': 0.35; 'should': 0.36; 'recent': 0.39; 'from:charset:utf-8': 0.61; 'simple': 0.61; 'content-disposition:inline': 0.62; "you've": 0.63; 'name': 0.63; 'to:addr:gmail.com': 0.65; 'received:86': 0.91; 'received:hu': 0.93 X-Spam-Flag: NO X-Spam-Score: -1.91 X-Spam-Level: X-Spam-Status: No, score=-1.91 tagged_above=-20 required=4 tests=[ALL_TRUSTED=-1, AWL=0.088, BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=0.9] autolearn=no Date: Mon, 16 Dec 2013 11:04:22 +0100 From: Ervin =?utf-8?Q?Heged=C3=BCs?= To: Jean Dubois Subject: Re: [newbie] trying socket as a replacement for nc References: <341e261d-ea7b-4d5a-ab41-9c0d44352d2b@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <341e261d-ea7b-4d5a-ab41-9c0d44352d2b@googlegroups.com> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387188274 news.xs4all.nl 2846 [2001:888:2000:d::a6]:40590 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62036 hello, > #!/usr/bin/env python > > """ > A simple echo client > """ > import socket as socket_mod > import bufsock as bufsock_mod [...] > Traceback (most recent call last): > File "./buftest.py", line 11, in > socket = socket_mod.socket(socket.AF_INET, socket.SOCK_STREAM) > NameError: name 'socket' is not defined you should replace the socket.AF_INET to socket_mod.AF_INET, and socket.SOCK_STREAM to socket_mod.SOCK_STREAM, if you've imported socket modul as socket_mod. But this is just an idea... :) a.