Sponsored Content
Full Discussion: How to Get the hostent data
Top Forums Programming How to Get the hostent data Post 302187549 by Saurabh78 on Monday 21st of April 2008 12:08:22 PM
Old 04-21-2008
I tried the code fromm link.
struct in_addr addr;

addr.s_addr = inet_addr( "121.243.2231.133" );
he = gethostbyaddr((char *)&addr, sizeof(struct in_addr), AF_INET);

Again he is NULL>\.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Howto capture data from rs232port andpull data into oracle database-9i automatically

Hi, i willbe very much grateful to u if u help me out.. if i simply connect pbx machine to printer by serial port RS232 then we find this view: But i want to capture this data into database automatically when the pbx is running.The table in database will contain similar to this view inthe... (1 Reply)
Discussion started by: boss
1 Replies

2. Shell Programming and Scripting

how to verify that copied data to remote system is identical with local data.

I have created simple shell script #!/bin/sh echo `date`; echo "Start .... find . -mtime +95 -print > /tmp/files.txt for file in `cat /tmp/files.txt` do echo "copying file - $file" /usr/local/bin/scp -p -P 2222 $file remote.hostname:/file/path echo "copid file -... (3 Replies)
Discussion started by: ynilesh
3 Replies

3. UNIX for Dummies Questions & Answers

converting a tabular format data to comma seperated data in KSH

Hi, Could anyone help me in changing a tabular format output to comma seperated file pls in K-sh. Its very urgent. E.g : username empid ------------------------ sri 123 to username,empid sri,123 Thanks, Hema:confused: (2 Replies)
Discussion started by: Hemamalini
2 Replies

4. Shell Programming and Scripting

Extract data based on match against one column data from a long list data

My input file: data_5 Ali 422 2.00E-45 102/253 140/253 24 data_3 Abu 202 60.00E-45 12/23 140/23 28 data_1 Ahmad 256 7.00E-45 120/235 140/235 22 data_4 Aman 365 8.00E-45 15/65 140/65 20 data_10 Jones 869 9.00E-45 65/253 140/253 18... (12 Replies)
Discussion started by: patrick87
12 Replies

5. UNIX for Dummies Questions & Answers

How to get data only inside polygon created by points which is part of whole data from file?

hiii, Help me out..i have a huge set of data stored in a file.This file has has 2 columns which is latitude & longitude of a region. Now i have a program which asks for the number of points & based on this number it asks the user to enter that latitude & longitude values which are in the same... (7 Replies)
Discussion started by: reva
7 Replies

6. Shell Programming and Scripting

Converting variable space width data into CSV data in bash

Hi All, I was wondering how I can convert each line in an input file where fields are separated by variable width spaces into a CSV file. Below is the scenario what I am looking for. My Input data in inputfile.txt 19 15657 15685 Sr2dReader 107.88 105.51... (4 Replies)
Discussion started by: vharsha
4 Replies

7. Shell Programming and Scripting

Generate tabular data based on a column value from an existing data file

Hi, I have a data file with : 01/28/2012,1,1,98995 01/28/2012,1,2,7195 01/29/2012,1,1,98995 01/29/2012,1,2,7195 01/30/2012,1,1,98896 01/30/2012,1,2,7083 01/31/2012,1,1,98896 01/31/2012,1,2,7083 02/01/2012,1,1,98896 02/01/2012,1,2,7083 02/02/2012,1,1,98899 02/02/2012,1,2,7083 I... (1 Reply)
Discussion started by: himanish
1 Replies

8. Shell Programming and Scripting

Parsing XML (and insert data) then output data (bash / Solaris)

Hi folks I have a script I wrote that basically parses a bunch of config and xml files works out were to add in the new content then spits out the data into a new file. It all works - apart from the xml and config file format in the new file with XML files the original XML (that ends up in... (2 Replies)
Discussion started by: dfinch
2 Replies

9. Shell Programming and Scripting

awk --> math-operation in data-record and joining with second file data

Hi! I have a pretty complex job - at least for me! i have two csv-files with meassurement-data: fileA ...... (2 Replies)
Discussion started by: IMPe
2 Replies
ADDR2ASCII(3)						   BSD Library Functions Manual 					     ADDR2ASCII(3)

NAME
addr2ascii, ascii2addr -- Generic address formatting routines LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <arpa/inet.h> char * addr2ascii(int af, const void *addrp, int len, char *buf); int ascii2addr(int af, const char *ascii, void *result); DESCRIPTION
The routines addr2ascii() and ascii2addr() are used to convert network addresses between binary form and a printable form appropriate to the address family. Both functions take an af argument, specifying the address family to be used in the conversion process. (Currently, only the AF_INET and AF_LINK address families are supported.) The addr2ascii() function is used to convert binary, network-format addresses into printable form. In addition to af, there are three other arguments. The addrp argument is a pointer to the network address to be converted. The len argument is the length of the address. The buf argument is an optional pointer to a caller-allocated buffer to hold the result; if a null pointer is passed, addr2ascii() uses a statically- allocated buffer. The ascii2addr() function performs the inverse operation to addr2ascii(). In addition to af, it takes two arguments, ascii and result. The ascii argument is a pointer to the string which is to be converted into binary. The result argument is a pointer to an appropriate network address structure for the specified family. The following gives the appropriate structure to use for binary addresses in the specified family: AF_INET struct in_addr (in <arpa/inet.h>) AF_LINK struct sockaddr_dl (in <net/if_dl.h>) AF_INET and AF_LINK constants are defined in <sys/socket.h> RETURN VALUES
The addr2ascii() function returns the address of the buffer it was passed, or a static buffer if the a null pointer was passed; on failure, it returns a null pointer. The ascii2addr() function returns the length of the binary address in bytes, or -1 on failure. EXAMPLES
The inet(3) functions inet_ntoa() and inet_aton() could be implemented thusly: #include <sys/socket.h> #include <arpa/inet.h> char * inet_ntoa(struct in_addr addr) { return addr2ascii(AF_INET, &addr, sizeof addr, 0); } int inet_aton(const char *ascii, struct in_addr *addr) { return (ascii2addr(AF_INET, ascii, addr) == sizeof(*addr)); } In actuality, this cannot be done because addr2ascii() and ascii2addr() are implemented in terms of the inet(3) functions, rather than the other way around. ERRORS
When a failure is returned, errno is set to one of the following values: [ENAMETOOLONG] The addr2ascii() routine was passed a len argument which was inappropriate for the address family given by af. [EPROTONOSUPPORT] Either routine was passed an af argument other than AF_INET or AF_LINK. [EINVAL] The string passed to ascii2addr() was improperly formatted for address family af. SEE ALSO
inet(3), linkaddr(3), inet(4) HISTORY
An interface close to this one was originally suggested by Craig Partridge. This particular interface originally appeared in the INRIA IPv6 implementation. AUTHORS
Code and documentation by Garrett A. Wollman, MIT Laboratory for Computer Science. BUGS
The original implementations supported IPv6. This support should eventually be resurrected. The NRL implementation also included support for the AF_ISO and AF_NS address families. The genericity of this interface is somewhat questionable. A truly generic interface would provide a means for determining the length of the buffer to be used so that it could be dynamically allocated, and would always require a ``struct sockaddr'' to hold the binary address. Unfortunately, this is incompatible with existing practice. This limitation means that a routine for printing network addresses from arbi- trary address families must still have internal knowledge of the maximum buffer length needed and the appropriate part of the address to use as the binary address. BSD
June 13, 1996 BSD
All times are GMT -4. The time now is 04:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy