10-27-2011
Sockets (C under Linux)
Hi,
I have to write an UDP broadcast. It works so far, but how can I get the actual network address at runtime? Should run under Linux and Unix (Solaris).
Thanks
10 More Discussions You Might Find Interesting
1. Programming
Hi !
I had a verry simple question to ask...
In unix when we create pipes.. the unnamed pipes that is...
is there any way to access those pipes outside the code ?
Another thing.. do sockets have an entry in the inode table ?
TIA,
Devyani. (1 Reply)
Discussion started by: devy8
1 Replies
2. Programming
I am looking for a way to have a program listen on a port (example: 8000) for communication I will be sending via that port to it(Linux Kernel machine). Once it recieves an appropiate command I need it to run a .bat file in linux.
I know what I need to do but I am running into a few problems:... (8 Replies)
Discussion started by: bigB8210
8 Replies
3. Programming
Hai,
How cani declare socket and collect the data in a string varialbe.
Since i am new to this i am asking this.
Can we connect multiple port.
Thank you. (6 Replies)
Discussion started by: arunkumar_mca
6 Replies
4. UNIX for Dummies Questions & Answers
how do i mointor how many sockets are opened from a particular foriegn address? (2 Replies)
Discussion started by: kirpond
2 Replies
5. Programming
I am using BSD TCP sockets under Debian Linux 2.6 and no matter what I do, the socket blocks on recv.
I have set O_NONBLOCK and O_NDELAY using fcntl to no effect.
Any ideas ? (3 Replies)
Discussion started by: johnmb
3 Replies
6. Programming
anyone and teach me how to save standard output to a file in a client/server socket. I know how to read them to the screen but i'm not quite sure how to save them to a file.
my read to screen file code:
memset(line, 0x0, LINE_ARRAY_SIZE);
while (recv(connectSocket, line, MAX_MSG, 0) >... (1 Reply)
Discussion started by: crunchyuser
1 Replies
7. Programming
Hi,i now moved into a different section where i need to use sockets.
i am completely nill in sockets.
can some body please provide me what are the requirements for a socket.
to use sockets in c.
thanks (1 Reply)
Discussion started by: MrUser
1 Replies
8. UNIX for Dummies Questions & Answers
We have a server-client communication in our application. Sockets are used for the communication. We are using AF_INET sockets with SOCK_STREAM(TCP/IP). Also these sockets are in Non Blocking mode (O_NONBLOCK). Application is written in C++ on UNIX.
In our system the Server will write to a... (4 Replies)
Discussion started by: sanushchacko
4 Replies
9. Red Hat
hai guys,
I'm doing a project in which one server communicates with several clients. How can i do it when i have different port numbers???:confused: (0 Replies)
Discussion started by: rajeshb6
0 Replies
10. Programming
Hi, i am student, think learning about c++, someone has a example the how establish a conection with sockets :b::b: (1 Reply)
Discussion started by: mmartinez
1 Replies
LEARN ABOUT OPENSOLARIS
net_getlifaddr
net_getlifaddr(9F) Kernel Functions for Drivers net_getlifaddr(9F)
NAME
net_getlifaddr - determine a network address for a given interface
SYNOPSIS
#include <sys/neti.h>
int net_getlifaddr(const net_data_t net, const phy_if_t ifp,
const net_if_t lif, int const type,
struct sockaddr* storage);
INTERFACE LEVEL
Solaris DDI specific (Solaris DDI).
PARAMETERS
net value returned from a successful call to net_protocol_lookup(9F).
ifp value returned from a successful call to net_phylookup(9F) or net_phygetnext(9F), indicating which network interface the infor-
mation should be returned from.
lif indicates the logical interface from which to fetch the address.
type indicates what type of address should be returned. See below for more details on this field.
storage pointer to an area of memory to store the address data.
DESCRIPTION
The net_getlifaddr() function retrieves the address information for each logical interface. Each call to net_getlifaddr() requires that the
caller pass a pointer to an array of address information types to retrieve, and an accompanying pointer to an array of pointers to struct
sockaddr structures to which to copy the address information. See net_lifgetnext(9F) for an example on how to use this function.
Each member of the address type array should be one of the values listed here.
NA_ADDRESS Return the network address associated with the logical interface (lif) that belongs to the network interface (ifp).
NA_PEER Return the address assigned to the remote host for point to point network interfaces for the given network/logical inter-
face.
NA_BROADCAST Return the broadcast address assigned to the given network/logical interface for network interfaces that support broadcast
packets.
NA_NETMASK Return the netmask associated with the given network/logical interface for network interfaces that support broadcast pack-
ets.
RETURN VALUES
The net_getlifaddr() function returns:
-1 The network protocol does not support this function.
0 Successful completion.
1 Unsuccessful.
CONTEXT
The net_getifaddr() function may be called from user, kernel, or interrupt context.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|Interface Stability |Committed |
+-----------------------------+-----------------------------+
SEE ALSO
net_lifgetnext(9F), net_phylookup(9F), net_phygetnext(9F)net_protocol_lookup(9F)
SunOS 5.11 13 Oct 2008 net_getlifaddr(9F)