C 言語関数:getsockname サンプルコード

サンプルコードを検索した結果です。


TITLE : Safari | Linux Socket Programming by Example -> Obtaining the Socket Address
If a C library function that you wrote receives a socket as an input argument, then you will not know what the socket address of that socket is. This is because your function did not create the socket; and, unless the socket address is also passed to your function as input, you will not know what the address is. The function getsockname(2) permits your function to obtain it........
http://alas.matf.bg.ac.rs/manuals/lspe/snode=48.html


TITLE : Safari | Linux Socket Programming by Example -> Obtaining the Socket Address
The function synopsis for getsockname(2) is as follows:.......
http://alas.matf.bg.ac.rs/manuals/lspe/snode=48.html
TITLE : Safari | Linux Socket Programming by Example -> Obtaining the Socket Address
int getsockname(int s, struct sockaddr *name, socklen_t *namelen).......
http://alas.matf.bg.ac.rs/manuals/lspe/snode=48.html
TITLE : Safari | Linux Socket Programming by Example -> Obtaining the Socket Address
Note that like the bind(2) function, getsockname(2) uses the generic address structure sockaddr because it can be used for any type of socket address. This will mean that you will likely need to apply the C language casting operator on the pointer supplied in this argument........
http://alas.matf.bg.ac.rs/manuals/lspe/snode=48.html
TITLE : Safari | Linux Socket Programming by Example -> Obtaining the Socket Address
Never supply the address of a constant for the socket address length in a call to getsockname(2). This should not be done because the length variable is updated with the actual number of bytes placed into the receiving address structure........
http://alas.matf.bg.ac.rs/manuals/lspe/snode=48.html
TITLE : Safari | Linux Socket Programming by Example -> Obtaining the Socket Address
3: * Demonstrate getsockname(2):.......
http://alas.matf.bg.ac.rs/manuals/lspe/snode=48.html
TITLE : Safari | Linux Socket Programming by Example -> Obtaining the Socket Address
44: z = getsockname(s,.......
http://alas.matf.bg.ac.rs/manuals/lspe/snode=48.html
TITLE : Safari | Linux Socket Programming by Example -> Obtaining the Socket Address
Listing 5.2 shows how getsockname(2) could be used by a library C function. Much of the main() program is review for you, because it is very similar to the main() program in Listing 5.1. The general steps used in the main() program are.......
http://alas.matf.bg.ac.rs/manuals/lspe/snode=48.html
TITLE : Safari | Linux Socket Programming by Example -> Obtaining the Socket Address
The maximum length is established in variable len_inet before calling getsockname(2). This establishes the maximum number of bytes of address information that can be returned........
http://alas.matf.bg.ac.rs/manuals/lspe/snode=48.html
TITLE : Safari | Linux Socket Programming by Example -> Obtaining the Socket Address
The getsockname(2) function is called in line 44. If successful, z will be set to zero, and the address will be loaded into the structure adr_inet. The length variable len_inet will be overwritten with the actual size used........
http://alas.matf.bg.ac.rs/manuals/lspe/snode=48.html
TITLE : Safari | Linux Socket Programming by Example -> Obtaining the Socket Address
In the last section, you saw that the function getsockname(2) is quite useful at obtaining a socket's address. However, there will be times when your code will want to determine the remote address that your socket is connected to. Determining the remote address of a socket is like finding out the caller's telephone number when they have called you耀imilar to North America's CallerID........
http://alas.matf.bg.ac.rs/manuals/lspe/snode=48.html
TITLE : Safari | Linux Socket Programming by Example -> Obtaining the Socket Address
The function to do this is called getpeername(2). This function will be useful to you when you start examining and writing server code. It is introduced here because it is so similar to getsockname(2). The function synopsis for getpeername(2) is as follows:.......
http://alas.matf.bg.ac.rs/manuals/lspe/snode=48.html
TITLE : Safari | Linux Socket Programming by Example -> Obtaining the Socket Address
The maximum length is established in variable len_inet before calling getsockname(2) (line 33). This establishes the maximum number of bytes of address information that can be returned........
http://alas.matf.bg.ac.rs/manuals/lspe/snode=48.html
TITLE : Safari | Linux Socket Programming by Example -> Obtaining the Socket Address
getsockname(2) function.......
http://alas.matf.bg.ac.rs/manuals/lspe/snode=48.html
TITLE : Safari | Linux Socket Programming by Example -> Obtaining the Socket Address
getsockname(2) 2nd 3rd.......
http://alas.matf.bg.ac.rs/manuals/lspe/snode=48.html
TITLE : Safari | Linux Socket Programming by Example -> Obtaining the Socket Address
getsockname(2) function 2nd 3rd.......
http://alas.matf.bg.ac.rs/manuals/lspe/snode=48.html
Googleで検索

https://www.google.co.jp/#q=getsockname