GETHOSTBYNAME()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All
I am trying to find the gethostbyname() equivalent function in kernel space. Does any one know that.
The reason is...
I am using UDP to transfer data from one machine to another. It is not one time transfer. Once I get a message from machine A; I need to send some message back to Machine A from Machine B. For that I was using the following lines in user space program. I need to do the same in kernel space. Could any one help me out in this.


struct hostent *data;
struct sockaddr_in server;
int sock;

sock = socket(AF_INET, SOCK_DGRAM , 0)

/* binding and all are done here */

data = gethostbyname("158.168.1.1");
memcpy (&server.sin_addrs, data->h_addr, data->h_length);
retval = sendto(sock,msg,sizeof(msg), 0, (struct sockaddr *) &server, sizeof server);



Thanking You Shesha

_________________________________________________________________
Cricket - World Cup 2003 http://server1.msn.co.in/msnspecials/worldcup03/ News, Views and Match Reports.


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux