LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-06-2006, 04:14 PM   #1
catchthefever
LQ Newbie
 
Registered: Sep 2005
Posts: 2

Rep: Reputation: 0
Network Config Help - RHL


I have an XP-based PC running VMWare with RHL. The PC has two ethernet cards directly connected to another ethernet device. I can ping the device from VMWare, and the device can ping my PC with the static IP addresses I set.

However, the server program running on the PC fails to bind. The error is, "cannot assign requested address".

Snippets:
Code:
if ((socket1 = socket(PF_INET, SOCK_STREAM, 0)) < 0) 
{
   //Error
}

addr1.sin_family      = PF_INET;
addr1.sin_addr.s_addr = htonl("192.55.55.55");
addr1.sin_port        = htons(0);
if ((bind (socket1, (struct sockaddr*)&addr1, sizeof(addr1))) < 0)
{
   //Error
}
The IP addresses of both the PC and the device are set up in the "hosts" of the cofguration. The PC ethernet devices are setup with their IP address, SN Mask of 255.255.255.0 and no default gateway address.

Thanks for any help.
 
Old 04-06-2006, 09:26 PM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 52
hi
when you write a server you bind it to all the local addresses
quick hack that will not work but provide some insight.
Code:
struct in_addr local_address;
uint16_t port = 0;
local_address.s_addr=INADDR_ANY;
addr1.sin_family = PF_INET;
addr1.sin_port = port;
addr1.sin_addr = local_adress;
bind();
listen();
 
Old 04-11-2006, 05:53 PM   #3
catchthefever
LQ Newbie
 
Registered: Sep 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks, that helped. It turns out that this program I inherited creates sockets and binds twice for each IP address. I can send but not receive. That's another issue.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
REDHAT 6.2 config / modules : usb storage, wired network, x config audan Linux - Hardware 2 02-18-2006 06:23 PM
Getting Network Card to Work (RHL 9) supertroop Linux - Networking 1 08-27-2005 10:14 PM
RHL 6.2 compat libs for RHL 9? cw3bst3r Programming 0 01-30-2004 10:41 AM
RHL 9.0 Unable to access Win2k Home Network or internet josh.linux Linux - Networking 5 11-14-2003 01:05 PM
Newb question: Install/config Tomcat 4.1.27 on RHL 9.0 rudejohn Linux - Software 2 09-01-2003 09:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:00 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration