LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 05-30-2004, 03:12 AM   #16
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872

From man inet_addr :
The inet_addr() function converts ... If the input is invalid, INADDR_NONE (usually -1) is returned. This is an obsolete interface to inet_aton, it is obsolete because -1 is a valid address (255.255.255.255), and inet_aton provides a cleaner way to indicate error return.

Try also :
Code:
/* Listen on all interfaces */
my_addr.sin_addr.s_addr = htonl( INADDR_ANY );
[edit]

And your IP adress dynamicly assigned is certainly not 10.12.110.57 if adress assigned by your ISP, if LAN adress it may be the good one.

Last edited by keefaz; 05-30-2004 at 03:16 AM.
 
Old 05-30-2004, 03:36 PM   #17
slackwarefan
Member
 
Registered: Oct 2003
Location: Florida
Distribution: Slackware
Posts: 273

Original Poster
Rep: Reputation: 30
Why should I use aton() instead of inet_addr()?
 
Old 05-30-2004, 04:15 PM   #18
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
[edit]
nothing more than the manual

Last edited by keefaz; 05-30-2004 at 04:19 PM.
 
Old 05-31-2004, 12:36 AM   #19
slackwarefan
Member
 
Registered: Oct 2003
Location: Florida
Distribution: Slackware
Posts: 273

Original Poster
Rep: Reputation: 30
Part 2 of my ongoing struggle with learning socket programming --

Thanks to everyone that helped me with my bind() problem, now I've gotten to the connect chapter. and it appears that connect won't work, strerror says the connection was refused. So I guess I got the code right, except I was trying to connect to google.com on port 80, I used google's IP address and defined the port as 80, I don't know what's wrong.
 
  


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
Bind returns 0 answers on the zone it is set to be master on Timur Sakayev Linux - Networking 2 12-29-2004 08:46 AM
tcp-echo server- bind() returns -1 vmbhosale Linux - Networking 1 03-15-2004 12:21 PM
Microsoft ISA Firewall Returns Port Scan Warnings From Linux BIND DNS Servers. ramram29 Linux - Security 4 01-26-2004 10:09 PM
How do I revert to Bind 8 from Bind 9? digging4roots Linux - Newbie 3 06-08-2002 04:40 PM
To 'Bind' or not to 'Bind' that is the question jsurgeson Linux - Newbie 2 03-24-2002 03:10 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:15 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
Open Source Consulting | Domain Registration