Networking Forums

Networking Forums > Network Hardware > Network Routers > IPv6 address not connecting but IPv4-mapped -IPv6 does. Please help.

Reply
Thread Tools Display Modes

IPv6 address not connecting but IPv4-mapped -IPv6 does. Please help.

 
 
DanielJohnson
Guest
Posts: n/a

 
      01-07-2009, 12:10 AM
hi, I am a newbie unix programmer and playing around with some IPv4
and IPv6 code. I have a Ubuntu box and its ifconfig is as follows:

eth0 Link encap:Ethernet HWaddr 00:1a:a0:b5:77:78
inet addr:10.54.190.137 Bcast:10.54.255.255 Mask:
255.255.0.0
inet6 addr: fe80::21a:a0ff:feb5:7778/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:301145950 errors:0 dropped:0 overruns:0 frame:0
TX packets:117146034 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:134173737050 (124.9 GB) TX bytes:95018619543 (88.4
GB)
Interrupt:16

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:30803018 errors:0 dropped:0 overruns:0 frame:0
TX packets:30803018 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1652234089 (1.5 GB) TX bytes:1652234089 (1.5 GB)

I have a very simple client and server python program. Server listens
on socket, the client connects to the server. In this program if
server gives IPv4 address, the server and client both talk fine. If
client gives a IPv4-mapped-IPv6 address like "::ffff:10.54.190.37",
the server and client both talk fine. But if I give address as
"fe80::21a:a0ff:feb5:7778", I get an errno = 22 (invalid argument). If
you see above, the interface eth0 has IPv4 address (10.54.190.137) and
IPv6 address (fe80::21a:a0ff:feb5:7778).

can you please suggest where am I going wrong ? Can't I connect using
IPv6 address only.

Please shed some insight.

thanks. Every reply is greatly appreciated.

The programs are as follows:

# client.py
# Echo client program
import socket
import sys

HOST = 'fe80::21a:a0ff:feb5:7778' # The remote host
#HOST = '::ffff:10.54.190.137' # The remote host
#HOST = '::1'
PORT = 50007 # The same port as used by the server
s = None
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC,
socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res
try:
s = socket.socket(af, socktype, proto)
except socket.error, msg:
s = None
continue
try:
s.connect(sa)
except socket.error, msg:
s.close()
s = None
continue
break
if s is None:
print 'could not open socket'
sys.exit(1)
s.send('Hello, world')
data = s.recv(1024)
s.close()
print 'Received', repr(data)

#server.py
# Echo server program
import socket
import sys

HOST = None # Symbolic name meaning all available
interfaces
PORT = 50007 # Arbitrary non-privileged port
s = None
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC,
socket.SOCK_STREAM, 0,
socket.AI_PASSIVE):
af, socktype, proto, canonname, sa = res
try:
s = socket.socket(af, socktype, proto)
except socket.error, msg:
s = None
continue
try:
s.bind(sa)
s.listen(1)
except socket.error, msg:
s.close()
s = None
continue
break
if s is None:
print 'could not open socket'
sys.exit(1)
conn, addr = s.accept()
print 'Connected by', addr
while 1:
data = conn.recv(1024)
if not data: break
conn.send(data)
conn.close()
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to listen on loopback address on both IPv4 and IPv6? Emmanuel Stapf [ES] Linux Networking 5 05-13-2009 04:26 PM
IPv6 infrastructure for Global and/or Site Specific IPv6 address JackFlash Windows Networking 1 06-25-2007 03:11 PM
Using IPv4 TCPMSS target with IPv6-in-IPv4 Mark T.B. Carroll Linux Networking 1 03-18-2007 10:30 AM
IPv6 to IPv4 tjm Windows Networking 0 03-23-2006 07:53 PM
IPv4 --> IPv6 Anthony T. Wilson Linux Networking 2 12-20-2003 08:23 PM



1 2 3 4 5 6 7 8 9 10 11