473,695 Members | 2,622 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use SocketServer with IPv6


I'm a Python newbie trying to figure out how to use SocketServer with
IPv6. I would like to set up a TCPServer working like below but how to
tell SocketServer I need to use AF_INET6?

import SocketServer
import logging as l

l.basicConfig(l evel=l.DEBUG,
format='%(ascti me)s %(levelname)-8s %(message)s',
datefmt='%a, %d %b %Y %H:%M:%S')
PORT = 5001

class CollectorHandle r(SocketServer. BaseRequestHand ler):

def setup(self):
l.info('%s connected!', self.client_add ress)
#self.request.s end('hi ' + str(self.client _address) + '\n')

def handle(self):
data = self.request.re cv(1024)
l.debug('Client sent this: %s\n', data)
def finish(self):
l.info('%s disconnected!', self.client_add ress)
#self.request.s end('bye ' + str(self.client _address) + '\n')

if __name__=='__ma in__':
#server host is a tuple ('host', port)
#myserver = SocketServer.Th readingTCPServe r(('', 5001), CollectorHandle r)
l.info('Collect or software starting up, creating TCPServer.')
myserver = SocketServer.TC PServer(('', PORT), CollectorHandle r)
l.info('Listeni ng to connections in port %d.', PORT)
myserver.serve_ forever()
except KeyboardInterru pt:

Thanks for any advice!

Tomi Hautakoski
Feb 12 '07 #1
0 1717

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Agent | last post by:
I would like to invite you and your associates to attend the US IPv6 (Internet Protocol version 6) Summit, December 8-11, 2003 in Crystal City, VA, near the Pentagon. This major opportunity to participate in transitioning to the new Internet is in response to both DoD and Industry requests for a concentrated, affordable conference in the Washington, D.C. area. This exciting and informative conference on the Next Generation Internet will...
by: Olivier Hoarau | last post by:
Hello, I have build a client/server application with the socket module. The server mades UDP broadcasting and the client only reads UDP broadcast messages. All work fine. Now I want to use for the same thing the socketserver module, it's ok for the client, but I don't succeed in making work the server :-(( Here is the client (which works)
by: Ergin Aytac | last post by:
I'm trying to run a script written in python and have some socket connection problems. I cutted the origin script (more than 1000 lines) so it is only the part of the connection and there is no functionalty but connecting to a server. I have no idea about programming with python so every hint is a present for me :) ------------------------------------ import SocketServer import os
by: Adil Hasan | last post by:
Hello Fred, I just ran across your question. I think that the following code will work: ----- SERVER CODE ------ import SocketServer import time class GreetingHandler(SocketServer.BaseRequestHandler): '''Class to handle sending a greeting to a client '''
by: missiplicity | last post by:
Hi, I am newbie to Python language and am taking my baby steps. I am using Python2.4 from ActiveState on W2K. I am trying to create a simple SocketServer program. Just adding the following 2 lines of code in the program result in the errors given below: import SocketServer print "SocketServer imported"
by: gregory_may | last post by:
First the research links: IPv6 spec (look for 'jumbo payload'): http://www.cs-ipv6.lancs.ac.uk/ipv6/documents/rfcs/archive/rfc1883.txt IPv6 Sample C# Client/Server http://www.codeproject.com/csharp/ipv6.asp I am developing an application where I need to broadcast information to clients. I have hit a 64K limit in UDP broadcasting. I am not exited
by: jiri.juranek | last post by:
Hello, is there any common function for validation if string contains valid ip address(both ipv4 and ipv6)? Or does sb wrote some regular expression for this? thanks J
by: Pramod TK | last post by:
Hello All, I have some queries related to python support for IPv6. Can you kindly clarify the doubts which I have - 1. Does python support IPv6? 2. Does it support setting of QoS flags? 3. Does it support tunneling of IPv6 on a IPv4 network? 4. If an IPv4 address is given, does it support this on a IPv6 network? If not can you kindly let me know, Are there any plans for supporting these features in future?
by: Giampaolo Rodola' | last post by:
I'm not sure if this is a question about python programming, system administration or sockets in general... I have the FTP server in my signature to which I'd want to add IPv6 support. My hosting company provides me a common IPv4 address. I'd like to set up my workstation (Windows XP or Linux Debian, doesn't really matter) to temporarily use IPv6 for trying to add such feature to my library (I work on both Windows XP and Linux). Could...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.