Questions tagged [gethostbyname]

140 questions
0
votes
1 answer

gethostbyname() not working

I am trying to find my source's IP yet it won't work. void getSourceIp(struct hostent *sourceHost, struct ip *ipStruct) { char sourceName[100]; if (gethostname(sourceName,sizeof(sourceName)) < 0) { perror("Error in function…
Teodora
  • 687
  • 2
  • 11
  • 21
0
votes
0 answers

gethostbyname and portno as an array

I'm working on server-client application in IDE Momentics Tool. This is the server part: int sockfd, portno, a; char *IP[16]; int server_to_client(struct AllPack allmess) { int portno; struct sockaddr_in serv_addr; struct hostent…
0
votes
1 answer

A Better Way to Verify Email Domain?

I have a small piece of C code to pull the email domain from a supplied string, then do a host lookup on it. It seems fairly simple, and works. Could this be simplified further, or made better, though? Thanks for viewing. struct hostent *host; int…
0
votes
0 answers

How to change the order of ipv4 addresses list in h_addr_list?

h_addr_list returns the list of IPv4 addresses on my system (both physical and virtual adapters). The order in which the list is populated co-incides with the order in which they are listed by ipconfig /all. If I change the order of adapters in…
0
votes
1 answer

PHP verify Baidu search engine by host when web host DNS server returns only IP

I've tried the following on IP addresses with user agents claiming to be the Baidu search engine. Unfortunately Just Host's DNS servers refuse to return anything but the IP address for the host.
John
  • 1
  • 13
  • 98
  • 177
0
votes
1 answer

netdb.h gethostbyname function in an embedded software system?

I'm writing embedded C software for a system that does not run on an OS. I want to be able to use netdb.h's gethostbyname() function. It is my understanding that whatever library it is part of is included in the Linux OS. Is it possible to include…
user1172282
  • 527
  • 1
  • 9
  • 19
0
votes
1 answer

IP address retrieved by gethostbyname() differs from browser connected to

I wrote a test program to capture packets for a given domain name. I was using gethostbyname() to retrieve ip address and pcap to capture packets destined for that ip address. The pcap_loop() count was set to -1 so it is supposed to keep capturing.…
AuA
  • 481
  • 1
  • 5
  • 11
0
votes
3 answers

gethostbyname problem

I wish to use "gethostbyname" in my Suse m/c but it is not returning any structure. but on the other systems it is working fine what could be the issue with my m/c ??
Arpit
  • 4,259
  • 10
  • 38
  • 43
0
votes
0 answers

Hostent returning null from char* . Works with hardcoded address

people. I know hostent is deprecated but have to use it for a project. For some reason if I do this... hp = getbyhostname ("www.google.com"); hp works all right. But then, if I do this: char *addre; addre = someFunction(); printf ("The address is…
0
votes
1 answer

Is there any iOS SDK equivalent of gethostbyname and inet_ntoa functions?

I saw several questions here, but is's still not clear for me. And could Apple reject for using standard gethostbyname function?
m8labs
  • 3,671
  • 2
  • 30
  • 32
0
votes
2 answers

Cannot access memory of Ip address from gethostname

I'm developing an after effects plugin and I'm trying to integrate raknet which is a c++ network library. When the raknet library is trying to get the ipv4 address by calling gethostbyname it then throws an error access violation reading location…
jacobsgriffith
  • 1,448
  • 13
  • 18
0
votes
1 answer

Floating point exception using function gethostbyname in static linked application

I have a code: struct hostent *hp = gethostbyname(dns.c_str()); in my app. I compile it on Ubuntu server linking all statically. All ok, but when i try to start this app on CentOS i have a error in this gethostbyname calling: Floating point…
Breakdown
  • 1,035
  • 4
  • 16
  • 26
0
votes
1 answer

Java/Android: getHostName() is always null with InetSocketAddress

I am using an Android app using a open source java library (Calimero). My code tries to get the Hostname and the Port using this code: private static KNXNetworkLinkIP connect(InetSocketAddress isaLocalEP, InetSocketAddress isaRemoteEP) { …
Mokkapps
  • 2,028
  • 9
  • 42
  • 67
0
votes
1 answer

How to use gethostbyname twice in code

I have this code: struct hostent *host; struct hostent *serverHost; if ((host = gethostbyname(param.ipadress)) == NULL) { return -1; } if ((serverHost = gethostbyname(param.dnsserver)) == NULL) { return -1; } and now when I tried host->h_addr…
Libor Zapletal
  • 13,752
  • 20
  • 95
  • 182
0
votes
0 answers

Any idea about gethostbyname on Android 4.0?

Our apk will connect to a server automatically when the user switches wifi network. It will invoke gethostbyname to find the server's ip first and then connect to the ip. All these code is written in C++.Everything works priori to Android 4.0. But…
crybird
  • 111
  • 1
  • 7
1 2 3
9
10