05-21-2002
Even easier than getpeername() is the function gethostname(). It returns the name of the computer that your program is running on. The name can then be used by gethostbyname(), to determine the IP address of your local machine.
#include <unistd.h>
int gethostname(char *hostname, size_t size);
The arguments are simple: hostname is a pointer to an array of chars that will contain the hostname upon the function's return, and size is the length in bytes of the hostname array.
The function returns 0 on successful completion, and -1 on error, setting errno as usual.
10 More Discussions You Might Find Interesting
1. Linux
I'm working on my homework to write a chatroom program. Different users can be on-line at the same and talk to each other.
I found that each time I invoked the accept function. A new socket was created. I don't how can I receive message from the client who is already on-line and send it to others.... (0 Replies)
Discussion started by: niukun
0 Replies
2. UNIX for Dummies Questions & Answers
I am going to purchase Unix Network Programming by Stevens. The only question I have is which edition to buy. The older (early 90's) edition, or the newer (late 90's) edition. I know conventional thinking would point to the latest ( and greatest?), but I wanted to get some feedback from the forum.... (3 Replies)
Discussion started by: dangral
3 Replies
3. Programming
I want to learn Network Programming with C,but I don't know how to start.
Thank you. (2 Replies)
Discussion started by: hubin330
2 Replies
4. Programming
hello,
i am learning networking programming in C from Unix Networking Programing by W. Richards Stevens. i want to compile the source given in this book on windows and linux platform. if somebody know this on windows, pls let me know. and regarding Linux, every time i compile a program on gcc,... (1 Reply)
Discussion started by: vibhory2j
1 Replies
5. Programming
Good day everyone,
Please help if you are interested in.
I need to do a chat client-server program.
Does anyone know where I can get references or sample programs?
Thank you very much for your time
Eric (2 Replies)
Discussion started by: powermind
2 Replies
6. Programming
So I'm making a program that gets the IP Address of an inputed website, then sends the IP Address to an inputed host. This program has no real meaning, but just a learning experiment. So I sucessfully made the program, then I wanted to try out recv(), and it produces some weird output; here is the... (2 Replies)
Discussion started by: Octal
2 Replies
7. UNIX for Dummies Questions & Answers
I want to develop a hybrid IM application which will consist of a chat and an offline messaging (BBS) part.
Server must support
Multiple connection (concurrent)
Arguments should not be hard coded (code will be checked at different machines)
No input at the command line
Must run in the... (3 Replies)
Discussion started by: never mind
3 Replies
8. Programming
Hi!
I am working on fedora..
trying to execute BSD4.4 client-server program which includes "unp.h" header file...
While executing make command, I got error like,
" expected " , " , " ; ",or ")" in connect_nonb file...ERROR 1 "
I tried to change mode of makefile but I can't get... (4 Replies)
Discussion started by: nisha_vaghela
4 Replies
9. Programming
I have written a client-server program which does some data from a file in server to the client. In this I don't want the client to wait indefinitely if server is not running. For this I am using SELECT system call, in this system call we can specify timings as an argument, which tells the client... (2 Replies)
Discussion started by: naresh046
2 Replies
10. UNIX for Dummies Questions & Answers
How does unix system administration, unix programming, unix network programming differ?
Please help. (0 Replies)
Discussion started by: thulasidharan2k
0 Replies
LEARN ABOUT DEBIAN
ost_ipv4multicast
ost::IPV4Multicast(3) Library Functions Manual ost::IPV4Multicast(3)
NAME
ost::IPV4Multicast -
A specialization of IPV4Address that provides address validation for multicast addresses.
SYNOPSIS
#include <address.h>
Inherits ost::IPV4Address.
Public Member Functions
IPV4Multicast ()
Create an Internet Multicast Address object with an empty (0.0.0.0) address.
IPV4Multicast (const struct in_addr address)
Convert the system internet address data type (struct in_addr) into a Common C++ IPV4Multicast object.
IPV4Multicast (const char *address)
Convert a null terminated ASCII multicast address string (example: '224.0.0.1') or multicast name string (example: 'sap.mcast.net')
directly into a Common C++ IPV4Multicast object.
Additional Inherited Members
Detailed Description
A specialization of IPV4Address that provides address validation for multicast addresses.
Whenever its value changes the new value is checked to be in the range from 224.0.0.1 through 239.255.255.255. If it is not, an exception
is thrown.
A multicast network address.
Author:
Federico Montesino p5087@quintero.fie.us.es
Constructor & Destructor Documentation
ost::IPV4Multicast::IPV4Multicast ()
Create an Internet Multicast Address object with an empty (0.0.0.0) address.
ost::IPV4Multicast::IPV4Multicast (const struct in_addraddress)
Convert the system internet address data type (struct in_addr) into a Common C++ IPV4Multicast object. Parameters:
address struct of system used binary internet address.
ost::IPV4Multicast::IPV4Multicast (const char *address)
Convert a null terminated ASCII multicast address string (example: '224.0.0.1') or multicast name string (example: 'sap.mcast.net')
directly into a Common C++ IPV4Multicast object. Works like IPV4Address(const char*).
Parameters:
address null terminated C string.
Author
Generated automatically by Doxygen for GNU CommonC++ from the source code.
GNU CommonC++ Sat Jun 23 2012 ost::IPV4Multicast(3)