150
"C" Programming Guide For Optimus S/R
printf ("Can not get remote name info");
.......................
}
Description
This routine returns the name of the peer connected to socket
s
. It only can be
used on a connected socket. (?)
The
name
is a result parameter that is filled in with the address of the
connecting entity, as known to the communications layer. The exact
format of the
name
parameter is determined by the address family in
which the communication is occurring.
The
namelen
is a value-result parameter; it initially contains the amount of
space pointed to by
name
; on return, it will contain the actual length, in
bytes, of the address returned. The
name
is truncated if the buffer provided
is too small.
Return
If successful, it returns 0.
On error, it returns -1.
The global variable
errno
is set to indicate the error condition encountered.
See Also
connect, getsockname
getsockname
Purpose
To get socket name.
Syntax
int getsockname (SOCKET s, struct sockaddr *name, int *namelen);
s
Descriptor identifying a socket
name
Pointer to a sockaddr structure receiving the local IP address
and port number
namelen
Pointer to an integer containing the length of
name
Example
SOCKET s;
struct sockaddr_in local_name;
int size_of_name;
........................
size_of_name = sizeof (local_name);
if (getsockname (s, (struct sockaddr*) &local_name, &size_of_name) < 0) {
printf ("Can not get local name info");
.......................
}
Description
This routine returns the current name for bound or connected socket
s
. It is
especially useful when a connect() call has been made without doing a bind
first. (?)
Содержание Optimus R
Страница 1: ...Printed on 20 March 2006 C Programming Guide Version 3 04 02 Optimus S Optimus R...
Страница 6: ......
Страница 8: ...2 C Programming Guide For Optimus S R...
Страница 12: ...6 C Programming Guide For Optimus S R The flow is illustrated as shown below...
Страница 23: ...Chapter 2 Development Environment 17 Different types signed unsigned Different types same size...
Страница 24: ...18 C Programming Guide For Optimus S R...
Страница 220: ...214 C Programming Guide For Optimus S R See Also FlashSize free_memory...
Страница 232: ...226 C Programming Guide For Optimus S R 4 11 Implementation defined Limits limits h float h Refer to limit h and float h...
Страница 238: ...232 C Programming Guide For Optimus S R...