From 96cf8dffe4f7b0b910f790066ae622dc429eb522 Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Tue, 9 Jul 2024 13:02:45 +0200 Subject: initial commit of version 23 --- man/socket_info.3 | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 man/socket_info.3 (limited to 'man/socket_info.3') diff --git a/man/socket_info.3 b/man/socket_info.3 new file mode 100644 index 0000000..899a7cb --- /dev/null +++ b/man/socket_info.3 @@ -0,0 +1,47 @@ +.TH socket_info 3 +.SH NAME +socket_info \- retrieving IP connection information for an existing socket +.SH SYNTAX +.B #include \(dqsocket_if.h\(dq + +int \fBsocket_local\fP(int \fIs\fR,char \fIip\fR[16], + uint16 *\fIport\fR,uint32 *\fIscope_id\fR); + +int \fBsocket_remote\fP(int \fIs\fR,char \fIip\fR[16], + uint16 *\fIport\fR,uint32 *\fIscope_id\fR); +.SH DESCRIPTION +.B socket_local +returns the local IPv6 or IPv4-mapped IPv6 address as \fIip\fR, +port as \fIport\fR and perhaps the scope_id as \fIscope_id\fR for the UDP or TCP socket. + +.B socket_remote +returns the remote IPv6 or IPv4-mapped IPv6 address as \fIip\fR, +port as \fIport\fR and perhaps the scope_id as \fIscope_id\fR for the UDP or TCP socket. + +.SH "RETURN CODES" +If something goes wrong, +.B socket_local +and +.B socket_remote +return +.IR -1 , +setting +.I errno +appropriately. +.SH EXAMPLE +#include + int \fIs\fR; + char \fIip\fR[16]; + uint16 \fIport\fR; + + if (socket_remote(s,ip,&port,0) == -1) + err_tmp("",111,"unable to get remote address: "); +.SH "SEE ALSO" +socket_if(3), +socket_bind(3), +socket_connect(3), +socket_recv(3), +socket_send(3), +socket_setup(3), +socket_tcp(3), +socket_udp(3) -- cgit v1.2.3