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.
 
 
 
 

49 lines
1.4 KiB

  1. .TH socket_connect4 3
  2. .SH NAME
  3. socket_connect4 \- attempt to make a TCP connection
  4. .SH SYNTAX
  5. .B #include <socket.h>
  6. int \fBsocket_connect4\fP(int \fIs\fR,const char \fIip\fR[4],uint16 \fIport\fR);
  7. .SH DESCRIPTION
  8. socket_connect4 attempts to make a connection from TCP socket \fIs\fR to
  9. TCP port \fIport\fR on IP address \fIip\fR.
  10. socket_connect4 may return
  11. .sp 1
  12. .IP \(bu
  13. 0, to indicate that the connection succeeded (and succeeded immediately,
  14. if the socket is non-blocking)
  15. .IP \(bu
  16. -1, setting errno to error_inprogress or error_wouldblock, to indicate
  17. that the socket is non-blocking
  18. .IP \(bu
  19. -1, setting errno to something else, to indicate that the connection
  20. failed (and failed immediately, if the socket is non-blocking).
  21. .PP
  22. When a background connection succeeds or fails, \fIs\fR becomes
  23. writable; you can use socket_connected to see whether the connection
  24. succeeded. If the connection failed, socket_connected returns 0,
  25. setting errno appropriately.
  26. Once a TCP socket is connected, you can use the read and write
  27. system calls to transmit data.
  28. You can call socket_connect4 without calling socket_bind4. This has the
  29. effect as first calling socket_bind4 with IP address 0.0.0.0 and port 0.
  30. .SH EXAMPLE
  31. #include <socket.h>
  32. int \fIs\fR;
  33. char \fIip\fR[4];
  34. uint16 \fIp\fR;
  35. \fIs\fR = socket_tcp();
  36. socket_bind4(s,ip,p);
  37. socket_connect4(s,ip,p);
  38. .SH "SEE ALSO"
  39. socket_connect6(3)