socket_info

Section: C Library Functions (3)
Index Return to Main Contents
 

NAME

socket_info - retrieving IP connection information for an existing socket  

SYNTAX

#include "socket_if.h"

int socket_local(int s,char ip[16],
                uint16 *port,uint32 *scope_id);

int socket_remote(int s,char ip[16],
                uint16 *port,uint32 *scope_id);  

DESCRIPTION

socket_local returns the local IPv6 or IPv4-mapped IPv6 address as ip, port as port and perhaps the scope_id as scope_id for the UDP or TCP socket.

socket_remote returns the remote IPv6 or IPv4-mapped IPv6 address as ip, port as port and perhaps the scope_id as scope_id for the UDP or TCP socket.

 

RETURN CODES

If something goes wrong, socket_local and socket_remote return -1, setting errno appropriately.  

EXAMPLE

#include <socket_if.h>
  int s;
  char ip[16];
  uint16 port;


  if (socket_remote(s,ip,&port,0) == -1)
    err_tmp("",111,"unable to get remote address: ");  

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)


 

Index

NAME
SYNTAX
DESCRIPTION
RETURN CODES
EXAMPLE
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 14:55:39 GMT, December 15, 2024