Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

37 lines
1.1 KiB

  1. .TH socket_bind6 3
  2. .SH NAME
  3. socket_bind6 \- set the local IP address and port of a socket
  4. .SH SYNTAX
  5. .B #include <socket.h>
  6. int \fBsocket_bind6\fP(int \fIs\fR, char \fIip\fR[16], uint16 \fIport\fR,
  7. uint32 \fIscope_id\fR);
  8. .SH DESCRIPTION
  9. socket_bind6 sets the local IP address and TCP/UDP port of a TCP/UDP
  10. socket \fIs\fR to \fIip\fR and \fIport\fR respectively.
  11. If the IP address is ::, the operating system chooses a local IP
  12. address. If \fIport\fR is 0, the operating system chooses a port.
  13. Normally socket_bind6 returns 0. If anything goes wrong, socket_bind6
  14. returns -1, setting errno appropriately.
  15. The \fIscope_id\fR should normally be zero, but for link-local addresses
  16. it specifies the interface number on which to bind. The interface
  17. number for a given network interface name can be found with
  18. \fBsocket_getifidx\fR.
  19. .SH EXAMPLE
  20. #include <socket.h>
  21. int \fIs\fR;
  22. char \fIip\fR[16];
  23. uint16 \fIp\fR;
  24. uint32 \fIscope_id\fR;
  25. \fIs\fR = socket_tcp6();
  26. socket_bind6(s,ip,p,scope_id);
  27. socket_connect6(s,ip,p);
  28. .SH "SEE ALSO"
  29. socket_bind4(3), socket_getifidx(3)