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.
 
 
 
 

55 lines
1.7 KiB

  1. .TH socket_connect6 3
  2. .SH NAME
  3. socket_connect6 \- attempt to make a TCP connection
  4. .SH SYNTAX
  5. .B #include <socket.h>
  6. int \fBsocket_connect6\fP(int \fIs\fR, const char \fIip\fR[16],
  7. uint16 \fIport\fR,uint32 \fIscope_id\fR);
  8. .SH DESCRIPTION
  9. socket_connect6 attempts to make a connection from TCP socket \fIs\fR to
  10. TCP port \fIport\fR on IP address \fIip\fR.
  11. The meaning of \fIscope_id\fR is dependent on the implementation and
  12. IPv6 IP. On link-local IPv6 addresses it specifies the outgoing
  13. interface index. The name (e.g. "eth0") for a given interface index can
  14. be queried with getifname. \fIscope_id\fR should normally be set to 0.
  15. socket_connect6 may return
  16. .sp 1
  17. .IP \(bu
  18. 0, to indicate that the connection succeeded (and succeeded immediately,
  19. if the socket is non-blocking)
  20. .IP \(bu
  21. -1, setting errno to error_inprogress or error_wouldblock, to indicate
  22. that the socket is non-blocking
  23. .IP \(bu
  24. -1, setting errno to something else, to indicate that the connection
  25. failed (and failed immediately, if the socket is non-blocking).
  26. .PP
  27. When a background connection succeeds or fails, \fIs\fR becomes
  28. writable; you can use socket_connected to see whether the connection
  29. succeeded. If the connection failed, socket_connected returns 0,
  30. setting errno appropriately.
  31. Once a TCP socket is connected, you can use the read and write
  32. system calls to transmit data.
  33. You can call socket_connect6 without calling socket_bind6. This has the
  34. effect as first calling socket_bind6 with IP address :: and port 0.
  35. .SH EXAMPLE
  36. #include <socket.h>
  37. int \fIs\fR;
  38. char \fIip\fR[16];
  39. uint16 \fIp\fR;
  40. \fIs\fR = socket_tcp6();
  41. socket_bind6(s,ip,p);
  42. socket_connect6(s,ip,p,0);
  43. .SH "SEE ALSO"
  44. socket_connect4(3), socket_getifname(3)