host « IP « C Q&A

Home
C Q&A
1.assembly
2.buffer
3.Card
4.Cast
5.compile
6.console
7.const
8.constructor
9.database
10.Date
11.Debug
12.Design
13.Development
14.DLL
15.encrypt
16.enum
17.eof
18.Event
19.fork
20.Format
21.gcc
22.gdb
23.graph
24.graphics
25.gui
26.Holiday Event
27.image
28.IP
29.iterator
30.macro
31.makefile
32.malloc
33.Menu
34.mysql
35.network
36.openssl
37.operator
38.password
39.pipe
40.preprocessor
41.printf
42.pthread
43.Regular expression
44.scanf
45.semaphore
46.SerialPort
47.server
48.Socket
49.sql
50.SQLserver
51.sscanf
52.std
53.stdin
54.stdout
55.stl
56.strcmp
57.stream
58.switch
59.Template
60.thread
61.timer
62.unix
63.video
64.Virtual
65.visualstudio
66.winapi
67.windows
68.xml
C Q&A » IP » host 

1. Segmentation fault when looking up host name and IP address    stackoverflow.com

I have the following piece of code for getting the hostname and IP address,

#include <stdlib.h>
#include <stdio.h>
#include <netdb.h> /* This is the header file needed for gethostbyname() */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>


int main(int ...

2. IP address of host...    bytes.com

a. There is no point posting code and telling us "it didn't work". How didn't it work? Did it compile without errors and warnings? If it compiled did you get unexpected results when you ran it? If you got unexpected results what was the expect result? What was the unexpected result? What, if any, was the input data to the program? ...

3. IP/HOST Conflict when gettin' the Users IP (Sockets)    cboard.cprogramming.com

4. how to get host IP using C ?    cboard.cprogramming.com

5. Host name to ip address - winsock2    forums.devshed.com

i am using inet_addr to convert my ip address, but how do i convert a host name/DNS (e.g. www.google.com) to the ip to be converted into long by inet_addr, or such. I did want to try getaddrinfo, but it requires the protocol and everything, so i don't want to use it as i have done the protocol simpler way using sockaddr_in. ...

6. Can I define host IP as this?    forums.devshed.com

First I define a struct hostent pointer as this struct hostent *phost; char szhostname[128]; then get the host IP address, gethostname( szhostname,128 );//get host name printf( szhostname ); phost = gethostbyname( szhostname );//get host IP finally, store the host IP address into struct_in variable addr. ( ( sockaddr_in* ) &addr )->sin_addr.S_un.S_addr = htonl((unsigned int)((unsigned char*)phost->h_addr_list[0]));//get the host IP address Is this ...

7. Getting IP of the HOST null    daniweb.com

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.