Sponsored Content
Top Forums Programming How to get IP Address of machine? Post 41905 by Perderabo on Thursday 16th of October 2003 10:08:50 PM
Old 10-16-2003
Why won't inet_ntoa work? It seems to work whenever I try it. Post your code, maybe I or someone else will see something. And there are dozens of servers with source code available for you to find on the Internet. Most are able to log client ip addresses.

The best network programming book is UNIX Network Programming by Rich Stevens.

I will ignore your quest for additional clues to my identity. Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Changing Machine IP address

Hopefully someone can help with this. I need the command to change the IP address on a machine (7 Replies)
Discussion started by: kkinnon
7 Replies

2. UNIX for Dummies Questions & Answers

Restricting access to a machine by IP Address

I have a need to allow only certain IP addresses to access a machine running solaris 9. I am not sure how this can be accomplished. Thanks in advance for your help. Patch (2 Replies)
Discussion started by: patch
2 Replies

3. IP Networking

how to retrieve IP address of a machine

hi is there is any command that retrieves the IP address of a machine. Also is there any function in c that does the same. thankx (5 Replies)
Discussion started by: mridula
5 Replies

4. Shell Programming and Scripting

How to get Windows machine's IP address from Unix?

I am using windows Xp. From windows I would connect to my IBM AIX unix machine using telnet client. Is there any command available to view the IP address of Windows machine from Unix? (Note that ifconfig will give unix mahcine's IP address currently logged in.) (3 Replies)
Discussion started by: mvictorvijayan
3 Replies

5. UNIX for Advanced & Expert Users

IP address of machine

Hi i want to know the Ip address of the machine from where i logged into the unix server and made some changes to a file. Can I know the last changes made to a unix file ? (3 Replies)
Discussion started by: harneet2004us
3 Replies

6. UNIX for Dummies Questions & Answers

IP address of Unix machine

Can any one please tell me how to find the IP address of the Unix machine we are in? (9 Replies)
Discussion started by: thoothukudiking
9 Replies

7. Solaris

How to get the IP address / Host name of client machine

Hi How to get the IP address / Host name of a particular user connected to Unix Server. For example: If used 'DevUser1' is connected to Unix server. I need to find out from which PC this connection has been made. How can this be achieved? Thanks (6 Replies)
Discussion started by: MVL
6 Replies

8. UNIX for Dummies Questions & Answers

Static IP address for solaris 10 virtual machine

Hi All I am having a solaris 10 virtual machine on vista (using vmware 7) laptop. Now i want to access virtual machine from vista using putty. Problem is that i insalled the solaris machine as dhcp. and whenever i connect to internet or reboot my system the IP address of solaris... (1 Reply)
Discussion started by: ankurk
1 Replies

9. Solaris

i want to set ip address to a virtual machine

hi all i want to set ip address to a vitrual machine i am using following command. but it is not ifconfig -a command output. what is wrong i dont know bash# ifconfig interfacename plumb bash# ifconfig interfacename auto-dhcp Please use code tags next time for your code and data. (4 Replies)
Discussion started by: nikhil kasar
4 Replies

10. Programming

I.p address of machine

i m writing a program which finds the i.p address of the machine. but it just prints out the first three character of the ifconfig output but i want to just print my i.p address lik 10.0.0.222 which is in second line after inet addr: code : #include<iostream> #include<cstdlib> using... (1 Reply)
Discussion started by: console
1 Replies
INET(3N)																  INET(3N)

NAME
inet_addr, inet_network, inet_ntoa, inet_makeaddr, inet_lnaof, inet_netof - Internet address manipulation routines SYNOPSIS
#include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> unsigned long inet_addr(cp) char *cp; unsigned long inet_network(cp) char *cp; char *inet_ntoa(in) struct in_addr in; struct in_addr inet_makeaddr(net, lna) long net, lna; long inet_lnaof(in) struct in_addr in; long inet_netof(in) struct in_addr in; DESCRIPTION
The routines inet_addr and inet_network each interpret character strings representing numbers expressed in the Internet standard "." nota- tion, returning numbers suitable for use as Internet addresses and Internet network numbers, respectively. The routine inet_ntoa takes an Internet address and returns an ASCII string representing the address in "." notation. The routine inet_makeaddr takes an Internet net- work number and a local network address and constructs an Internet address from it. The routines inet_netof and inet_lnaof break apart Internet host addresses, returning the network number and local network address part, respectively. All Internet address are returned in network order (bytes ordered from left to right). All network numbers and local address parts are returned as machine format integer values. INTERNET ADDRESSES
Values specified using the "." notation take one of the following forms: a.b.c.d a.b.c a.b a When four parts are specified, each is interpreted as a byte of data and assigned, from left to right, to the four bytes of an Internet address. Note that when an Internet address is viewed as a 32-bit integer quantity on the VAX the bytes referred to above appear as "d.c.b.a". That is, VAX bytes are ordered from right to left. When a three part address is specified, the last part is interpreted as a 16-bit quantity and placed in the right most two bytes of the network address. This makes the three part address format convenient for specifying Class B network addresses as "128.net.host". When a two part address is supplied, the last part is interpreted as a 24-bit quantity and placed in the right most three bytes of the net- work address. This makes the two part address format convenient for specifying Class A network addresses as "net.host". When only one part is given, the value is stored directly in the network address without any byte rearrangement. All numbers supplied as "parts" in a "." notation may be decimal, octal, or hexadecimal, as specified in the C language (i.e., a leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies octal; otherwise, the number is interpreted as decimal). SEE ALSO
gethostbyname(3N), getnetent(3N), hosts(5), networks(5), DIAGNOSTICS
The value -1 is returned by inet_addr and inet_network for malformed requests. BUGS
The problem of host byte ordering versus network byte ordering is confusing. A simple way to specify Class C network addresses in a manner similar to that for Class B and Class A is needed. The string returned by inet_ntoa resides in a static memory area. Inet_addr should return a struct in_addr. 4.2 Berkeley Distribution May 27, 1986 INET(3N)
All times are GMT -4. The time now is 04:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy