LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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
 
LinkBack Search this Thread
Old 06-04-2004, 03:02 AM   #1
abrb220
Member
 
Registered: Jul 2003
Location: Roodepoort South Africa
Distribution: Redhat / Suse
Posts: 39

Rep: Reputation: 15
Sockets : Getaddrinfo call fails


I call getaddrinfo in my socket client program (c++) and
it fails with ECONNREFUSED : No on listening on the remote address.

Code :
getaddrinfo("localhost",0,0, &addinfo);

Iptables is stopped.Netstat shows the machine listening on ftp, http at least.
Tried running the program as root and still the same.

If I change the call to :
getaddrinfo("localhost",80,0, &addinfo);

it failes with a EAI_SERVICE.

I can telnet into port 80 ( http) and do a GET fine!

What's up?
 
Old 06-04-2004, 12:09 PM   #2
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
u r supposed to pass STRING(char *), not integers for the service type.
 
Old 06-06-2004, 11:26 PM   #3
abrb220
Member
 
Registered: Jul 2003
Location: Roodepoort South Africa
Distribution: Redhat / Suse
Posts: 39

Original Poster
Rep: Reputation: 15
Sorry ... typo when I retype it in the post..

The second call should have "" around 80, the second parameter.The code is like that.

The first call is fine though.It is working now thanks.I pass a hint struct(third parm) along and it works.

Cheers
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C sockets Select call when to use? cranium2004 Programming 1 03-14-2005 05:56 AM
"getaddrinfo failed: Temporary failure in name resolution" SammyK Linux - Networking 3 03-09-2005 11:43 AM
What do you call your remote control? I call mine... RHLinuxGUY General 19 10-18-2004 06:23 AM
Ioctl() call fails Custer Linux - Wireless Networking 0 02-16-2004 12:47 PM
Samba 2.2.7a fails to call add user script on Red Hat 9 DrFooMod2 Linux - Networking 4 07-17-2003 09:33 PM


All times are GMT -5. The time now is 05:24 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration