zhhyu7 commented on code in PR #21418:
URL: https://github.com/apache/nuttx/pull/21418#discussion_r4463588042
##########
net/local/local_bind.c:
##########
@@ -100,6 +100,27 @@ int psock_local_bind(FAR struct socket *psock,
strlcpy(conn->lc_path, &unaddr->sun_path[index], sizeof(conn->lc_path));
+#ifdef CONFIG_NET_LOCAL_DGRAM
+ if (psock->s_type == SOCK_DGRAM)
+ {
+ int ret;
+
+ ret = local_create_halfduplex(conn, conn->lc_path, conn->lc_rcvsize);
+ if (ret < 0)
+ {
+ return ret;
+ }
+
+ ret = local_open_receiver(conn,
+ _SS_ISNONBLOCK(conn->lc_conn.s_flags));
+ if (ret < 0)
+ {
+ local_release_halfduplex(conn);
+ return ret;
+ }
+ }
+#endif
+
conn->lc_state = LOCAL_STATE_BOUND;
Review Comment:
Done.
##########
net/local/local_sendmsg.c:
##########
@@ -393,6 +310,81 @@ static ssize_t local_sendto(FAR struct socket *psock,
#endif /* CONFIG_NET_LOCAL_DGRAM */
}
+/****************************************************************************
+ * Name: local_send
+ *
+ * Description:
+ * Send a local packet as a stream.
+ *
+ * Input Parameters:
+ * psock An instance of the internal socket structure.
+ * buf Data to send
+ * len Length of data to send
+ * flags Send flags (ignored for now)
+ *
+ * Returned Value:
+ * On success, returns the number of characters sent. On error,
+ * -1 is returned, and errno is set appropriately (see send() for the
+ * list of errno numbers).
+ *
+ ****************************************************************************/
+
+static ssize_t local_send(FAR struct socket *psock,
+ FAR const struct iovec *buf,
+ size_t len, int flags)
+{
+ ssize_t ret;
+
+ switch (psock->s_type)
+ {
+ case SOCK_STREAM:
+ {
+ FAR struct local_conn_s *conn = psock->s_conn;
+
+ DEBUGASSERT(buf);
+
+ if (conn->lc_state != LOCAL_STATE_CONNECTED)
+ {
+ nerr("ERROR: not connected\n");
+ return -ENOTCONN;
+ }
+
+ if (conn->lc_outfile.f_inode == NULL)
+ {
+ return -EPIPE;
+ }
+
+ ret = local_send_packet(&conn->lc_outfile, buf, len);
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]