@@ -64,6 +64,15 @@ int ff_sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp,
6464
6565int ff_ioctl (int fd , unsigned long request , ...);
6666
67+ /*
68+ * While get sockfd from this API, and then need set it to non-blocking mode like this,
69+ * Otherwise, sometimes the socket interface will not work properly, such as `ff_write()`
70+ *
71+ * int on = 1;
72+ * ff_ioctl(sockfd, FIONBIO, &on);
73+ *
74+ * See also `example/main.c`
75+ */
6776int ff_socket (int domain , int type , int protocol );
6877
6978int ff_setsockopt (int s , int level , int optname , const void * optval ,
@@ -87,6 +96,21 @@ int ff_getsockname(int s, struct linux_sockaddr *name,
8796ssize_t ff_read (int d , void * buf , size_t nbytes );
8897ssize_t ff_readv (int fd , const struct iovec * iov , int iovcnt );
8998
99+
100+ /*
101+ * Write data to the socket sendspace buf.
102+ *
103+ * Note:
104+ * The `fd` parameter need set non-blocking mode in advance if F-Stack's APP.
105+ * Otherwise if the `nbytes` parameter is greater than
106+ * `net.inet.tcp.sendspace + net.inet.tcp.sendbuf_inc`,
107+ * the API will return -1, but not the length that has been sent.
108+ *
109+ * You also can modify the value of `net.inet.tcp.sendspace`(default 16384 bytes)
110+ * and `net.inet.tcp.sendbuf_inc`(default 16384 bytes) with `config.ini`.
111+ * But it should be noted that not all parameters can take effect, such as 32768 and 32768.
112+ * `ff_sysctl` can see there values while APP is running.
113+ */
90114ssize_t ff_write (int fd , const void * buf , size_t nbytes );
91115ssize_t ff_writev (int fd , const struct iovec * iov , int iovcnt );
92116
0 commit comments