📄 zbufsocklib.html
字号:
caddr_t buf, /* pointer to user buffer */ int freeArg /* user-provided argument to free routine */ )</pre>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><p>The number of bytes sent, or ERROR if the call fails.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./zbufSockLib.html#top">zbufSockLib</a></b>, <b><i><a href="./zbufSockLib.html#zbufSockSend">zbufSockSend</a></i>( )</b>, <b><i><a href="./sockLib.html#send">send</a></i>( )</b><hr><a name="zbufSockBufSendto"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>zbufSockBufSendto</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>zbufSockBufSendto</i>( )</strong> - create a zbuf from a user message and send it to a UDP socket</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int zbufSockBufSendto ( int s, /* socket to send to */ char * buf, /* pointer to data buffer */ int bufLen, /* number of bytes to send */ VOIDFUNCPTR freeRtn, /* free routine callback */ int freeArg, /* argument to free routine */ int flags, /* flags to underlying protocols */ struct sockaddr * to, /* recipient's address */ int tolen /* length of <i>to</i> socket addr */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine creates a zbuf from the user buffer <i>buf</i>, and sendsit to the datagram socket named by <i>to</i>. The socket <i>s</i> is thesending socket.<p>The user-provided free routine callback at <i>freeRtn</i> is called when <i>buf</i>is no longer in use by the UDP/IP network stack. Applications canexploit this callback to receive notification that <i>buf</i> is free.If <i>freeRtn</i> is NULL, the routine functions normally, except that the application has no way of being notified when <i>buf</i> is released by thenetwork stack. The free routine runs in the context of the task that lastreferences the buffer. This is typically either tNetTask context, or the caller's task context. Declare <i>freeRtn</i> as follows(using whatever name is convenient):<pre> void freeCallback ( caddr_t buf, /* pointer to user buffer */ int freeArg /* user-provided argument to free routine */ )</pre>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><p>The number of bytes sent, or ERROR if the call fails.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./zbufSockLib.html#top">zbufSockLib</a></b>, <b><i><a href="./zbufSockLib.html#zbufSockSendto">zbufSockSendto</a></i>( )</b>, <b><i><a href="./sockLib.html#sendto">sendto</a></i>( )</b><hr><a name="zbufSockRecv"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>zbufSockRecv</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>zbufSockRecv</i>( )</strong> - receive data in a zbuf from a TCP socket</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>ZBUF_ID zbufSockRecv ( int s, /* socket to receive data from */ int flags, /* flags to underlying protocols */ int * pLen /* number of bytes requested/returned */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine receives data from a connection-based (stream) socket, andreturns the data to the user in a newly created zbuf.<p>The <i>pLen</i> parameter indicates the number of bytes requested by the caller.If the operation is successful, the number of bytes received iscopied to <i>pLen</i>.<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>Once the user application is finished with the zbuf, <b><i><a href="./zbufLib.html#zbufDelete">zbufDelete</a></i>( )</b> shouldbe called to return the zbuf memory buffer to the VxWorks network stack.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>The zbuf ID of a newly created zbuf containing the received data,or NULL if the operation fails.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./zbufSockLib.html#top">zbufSockLib</a></b>, <b><i><a href="./sockLib.html#recv">recv</a></i>( )</b><hr><a name="zbufSockRecvfrom"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>zbufSockRecvfrom</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>zbufSockRecvfrom</i>( )</strong> - receive a message in a zbuf from a UDP socket</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>ZBUF_ID zbufSockRecvfrom ( int s, /* socket to receive from */ int flags, /* flags to underlying protocols */ int * pLen, /* number of bytes requested/returned */ 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, andreturns the message to the user in a newly created zbuf.<p>The message is received regardless of whether the socket is connected.If <i>from</i> is nonzero, the address of the sender's socket is copied to it.Initialize the value-result parameter <i>pFromLen</i> to the size ofthe <i>from</i> buffer. On return, <i>pFromLen</i> contains the actual size of theaddress stored in <i>from</i>.<p>The <i>pLen</i> parameter indicates the number of bytes requested by the caller.If the operation is successful, the number of bytes received iscopied to <i>pLen</i>.<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>Once the user application is finished with the zbuf, <b><i><a href="./zbufLib.html#zbufDelete">zbufDelete</a></i>( )</b> shouldbe called to return the zbuf memory buffer to the VxWorks network stack.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>The zbuf ID of a newly created zbuf containing the received message,or NULL if the operation fails.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./zbufSockLib.html#top">zbufSockLib</a></b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -