Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
07-01-2005, 07:21 AM
|
#1
|
|
LQ Newbie
Registered: Jul 2005
Posts: 5
Rep:
|
bind() fail while binding to an IPv6 Address
I enabled IPv6 on Redhat Linux 7.3 and Redhat AS 3.
I have written a sample Client and Server program using the IPv4/IPv6 compatible socket calls.
When i give IPv4 address, the server binds and listens to client connections.
But when i give IPv6 Address, bind fails as below
bind() failed with error 22: Invalid argument
ifconfig -a lists both IPv4 and IPv6 addresses.
I am able to ping both the addresses.
This same code works fine on Solaris,AIX,Windows,HPUX but on both the Linux distributions its not working.
Please help.
Thanks
yash
|
|
|
|
07-03-2005, 03:25 PM
|
#2
|
|
Moderator
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,476
Rep: 
|
Please show fragments of your code, especially all socket-related functions.
|
|
|
|
07-04-2005, 04:23 AM
|
#3
|
|
LQ Newbie
Registered: Jul 2005
Posts: 5
Original Poster
Rep:
|
Thanks mara for your reply..
here is the code fragment
Client Code :
RetVal = getaddrinfo("fe80::210:b5ff:fea6:d412", "16000", &Hints, &AI);
ConnSocket = socket(AI->ai_family, AI->ai_socktype, AI->ai_protocol);
i = connect(ConnSocket, (struct sockaddr *)AI->ai_addr, AI->ai_addrlen);
Socket Code :
RetVal = getaddrinfo("fe80::210:b5ff:fea6:d412%eth0", "16000", &Hints, &AI);
ServSock1 = socket(AI->ai_family, AI->ai_socktype, AI->ai_protocol);
i = bind(ServSock1, (struct sockaddr *)AI->ai_addr, AI->ai_addrlen);
i = listen(ServSock1, 5);
earlier i dint give the "%eth0" along with the address in the server code.. hence the bind was getting failed. After giving tht bind got succeded but now i am havng a problem on the client side.
the connect() is getting failed with the following message
"Error Connection establishment, error 22: Invalid argument"
Please help..
thnks
yash
|
|
|
|
07-05-2005, 05:21 PM
|
#4
|
|
Moderator
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,476
Rep: 
|
It's hard to say without seeing all the values you pass, but I'd look into AI->ai_addrlen. Better, print out the values. Maybe the protocl doesn't make sense etc.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 02:56 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|