⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 socklib.html

📁 Vxworks API操作系统和驱动程序设计API。压缩的HTML文件
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<a name="connectWithTimeout"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>connectWithTimeout(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>connectWithTimeout(&nbsp;)</strong> - attempt socket connection within a specified duration</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS connectWithTimeout    (    int               sock,    /* socket descriptor */    struct sockaddr * adrs,    /* addr of the socket to connect */    int               adrsLen, /* length of the socket, in bytes */    struct timeval *  timeVal  /* time-out value */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>Use this routine as an alternative to <b><a href="./sockLib.html#connect">connect</a>(&nbsp;)</b> when your applicationrequires a shorter time out on a connection attempt.  By design, a TCPconnection attempt times out after 75 seconds if unsuccessful.  Thus, a blocking TCP socket <b><a href="./sockLib.html#connect">connect</a>(&nbsp;)</b> call might not return for 75 seconds.  A <b><a href="./sockLib.html#connectWithTimeout">connectWithTimeout</a>(&nbsp;)</b> call lets you reduce this time out by scheduling an abort of the connection attempt if it is not successful before <i>timeVal</i>.However, <b><a href="./sockLib.html#connectWithTimeout">connectWithTimeout</a>(&nbsp;)</b> does not actually change the TCP timeoutvalue.  Thus, you cannot use <b><a href="./sockLib.html#connectWithTimeout">connectWithTimeout</a>(&nbsp;)</b> to lengthen theconnection time out beyond the TCP default.<p>In all respects other than the time out value, a <b><a href="./sockLib.html#connectWithTimeout">connectWithTimeout</a>(&nbsp;)</b> call behaves exactly like <b><a href="./sockLib.html#connect">connect</a>(&nbsp;)</b>. Thus, if no application is listening for connections at the other end, <b><a href="./sockLib.html#connectWithTimeout">connectWithTimeout</a>(&nbsp;)</b> returns immediately just like <b><a href="./sockLib.html#connect">connect</a>(&nbsp;)</b>.  If you specify a NULL pointer for <i>timeVal</i>, <b><a href="./sockLib.html#connectWithTimeout">connectWithTimeout</a>(&nbsp;)</b> behaves exactly like a <b><a href="./sockLib.html#connect">connect</a>(&nbsp;)</b> call.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if a new connection is not established before timeout.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./sockLib.html#top">sockLib</a></b>, <b><a href="./sockLib.html#connect">connect</a>(&nbsp;)</b><hr><a name="sendto"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>sendto(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>sendto(&nbsp;)</strong> - send a message to a socket</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int sendto    (    int               s,      /* socket to send data to */    caddr_t           buf,    /* pointer to data buffer */    int               bufLen, /* length of buffer */    int               flags,  /* flags to underlying protocols */    struct sockaddr * to,     /* recipient's address */    int               tolen   /* length of <i>to</i> sockaddr */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sends a message to the datagram socket named by <i>to</i>.  Thesocket <i>s</i> is received by the receiver as the sending socket.<p>The maximum length of <i>buf</i> is subject to the limits on UDP buffersize. See the discussion of <b>SO_SNDBUF</b> in the <b><a href="./sockLib.html#setsockopt">setsockopt</a>(&nbsp;)</b> manualentry.<p>You can OR the following values into the <i>flags</i> parameter with thisoperation:<p><dl><dt><b>MSG_OOB</b> (0x1)<dd>Out-of-band data.<p><dt><b>MSG_DONTROUTE</b> (0x4)<dd>Send without using routing tables.</dl><p></blockquote><h4>RETURNS</h4><blockquote><p>The number of bytes sent, or ERROR if the call fails.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./sockLib.html#top">sockLib</a></b>, <b><a href="./sockLib.html#setsockopt">setsockopt</a>(&nbsp;)</b><hr><a name="send"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>send(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>send(&nbsp;)</strong> - send data to a socket</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int send    (    int          s,           /* socket to send to */    const char * buf,         /* pointer to buffer to transmit */    int          bufLen,      /* length of buffer */    int          flags        /* flags to underlying protocols */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine transmits data to a previously established connection-based(stream) socket.<p>The maximum length of <i>buf</i> is subject to the limitson TCP buffer size; see the discussion of <b>SO_SNDBUF</b> in the<b><a href="./sockLib.html#setsockopt">setsockopt</a>(&nbsp;)</b> manual entry.<p>You may OR the following values into the <i>flags</i> parameter with thisoperation:<p><dl><dt><b>MSG_OOB</b> (0x1)<dd>Out-of-band data.<p><dt><b>MSG_DONTROUTE</b> (0x4)<dd>Send without using routing tables.</dl><p></blockquote><h4>RETURNS</h4><blockquote><p>The number of bytes sent, or ERROR if the call fails.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./sockLib.html#top">sockLib</a></b>, <b><a href="./sockLib.html#setsockopt">setsockopt</a>(&nbsp;)</b>, <b><a href="./sockLib.html#sendmsg">sendmsg</a>(&nbsp;)</b><hr><a name="sendmsg"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>sendmsg(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>sendmsg(&nbsp;)</strong> - send a message to a socket</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int sendmsg    (    int             sd,       /* socket to send to */    struct msghdr * mp,       /* scatter-gather message header */    int             flags     /* flags to underlying protocols */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sends a message to a datagram socket.  It may be used inplace of <b><a href="./sockLib.html#sendto">sendto</a>(&nbsp;)</b> to decrease the overhead of reconstructing themessage-header structure (<b>msghdr</b>) for each message.<p>For BSD 4.4 sockets a copy of the <i>mp</i>->msg_iov array will be made.  Thisrequires a cluster from the network stack system pool of size <i>mp</i>->msg_iovlen * sizeof (struct iovec) or 8 bytes.<p></blockquote><h4>RETURNS</h4><blockquote><p>The number of bytes sent, or ERROR if the call fails.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./sockLib.html#top">sockLib</a></b>, <b><a href="./sockLib.html#sendto">sendto</a>(&nbsp;)</b><hr><a name="recvfrom"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>recvfrom(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>recvfrom(&nbsp;)</strong> - receive a message from a socket</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int recvfrom    (    int               s,       /* socket to receive from */    char *            buf,     /* pointer to data buffer */    int               bufLen,  /* length of buffer */    int               flags,   /* flags to underlying protocols */    struct sockaddr * from,    /* where to copy sender's addr */    int *             pFromLen /* value/result length of <i>from</i> */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine receives a message from a datagram socket regardless ofwhether it is connected.  If <i>from</i> is non-zero, the address of thesender's socket is copied to it.  The value-result parameter <i>pFromLen</i>should be initialized to the size of the <i>from</i> buffer.  On return,<i>pFromLen</i> contains the actual size of the address stored in <i>from</i>.<p>The maximum length of <i>buf</i> is subject to the limits on UDP buffersize; see the discussion of <b>SO_RCVBUF</b> in the <b><a href="./sockLib.html#setsockopt">setsockopt</a>(&nbsp;)</b> manualentry.<p>You may OR the following values into the <i>flags</i> parameter with thisoperation:<p><dl><dt><b>MSG_OOB</b> (0x1)<dd>Out-of-band data.<p><dt><b>MSG_PEEK</b> (0x2)<dd>Return data without removing it from socket.</dl><p></blockquote><h4>RETURNS</h4><blockquote><p>The number of number of bytes received, or ERROR if the call fails.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./sockLib.html#top">sockLib</a></b>, <b><a href="./sockLib.html#setsockopt">setsockopt</a>(&nbsp;)</b><hr><a name="recv"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>recv(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>recv(&nbsp;)</strong> - receive data from a socket</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int recv    (    int    s,                 /* socket to receive data from */    char * buf,               /* buffer to write data to */    int    bufLen,            /* length of buffer */    int    flags              /* flags to underlying protocols */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine receives data from a connection-based (stream) socket.<p>The maximum length of <i>buf</i> is subject to the limits on TCP buffersize; see the discussion of <b>SO_RCVBUF</b> in the <b><a href="./sockLib.html#setsockopt">setsockopt</a>(&nbsp;)</b> manualentry.<p>You may OR the following values into the <i>flags</i> parameter with thisoperation:<p><dl><dt><b>MSG_OOB</b> (0x1)<dd>Out-of-band data.<p><dt><b>MSG_PEEK</b> (0x2)<dd>Return data without removing it from socket.</dl><p></blockquote><h4>RETURNS</h4><blockquote><p>The number of bytes received, or ERROR if the call fails.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./sockLib.html#top">sockLib</a></b>, <b><a href="./sockLib.html#setsockopt">setsockopt</a>(&nbsp;)</b><hr><a name="recvmsg"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>recvmsg(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>recvmsg(&nbsp;)</strong> - receive a message from a socket</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int recvmsg    (    int             sd,       /* socket to receive from */    struct msghdr * mp,       /* scatter-gather message header */    int             flags     /* flags to underlying protocols */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -