LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-09-2006, 07:09 AM   #1
ayeshaseerin
LQ Newbie
 
Registered: May 2006
Posts: 1

Rep: Reputation: 0
ipv6 program doubt


For the server side , i did something like

int s = -1;
struct addrinfo hints={0}, *result, *ptr;

hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
hints.ai_flags = AI_PASSIVE;
rc = getaddrinfo( NULL, ”5001”, &hints, &result );
If ( 0 != rc ) {
// error
}
for(ptr=result; ptr != NULL ;ptr=ptr->ai_next)
{
s = socket( ptr->ai_family, ptr->ai_socktype,
ptr->ai_protocol );
bind( s, ptr->ai_addr, ptr->ai_addrlen );
listen( s, SOMAXCONN );
// Add ‘s’ to a list
}
The first bind succeeds , but the second fails with "Address already in use" ..

I even used setsockopt SO_REUSEADDR ..

I still get the error ..
This is on red hat 9 ..

anyone knows how i can go abot this ..

Basically i need one ipv4 and ipv6 socket for a particular port number ..

Thanks
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Newbie: doubt regarding program files amit_chandak Linux - Newbie 5 03-04-2006 03:57 PM
Program to eject cdrom drive ... doubt tuxfood Programming 3 07-20-2005 03:33 AM
Doubt in C++ zeropash Programming 1 07-05-2005 12:33 PM
a doubt... ashesh Linux - General 6 09-08-2003 01:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration