Hi Daniel,
So 0 means there are no flags? This is also from MSDN:
The send
<http://msdn.microsoft.com/library/en-us/winsock/winsock/send_2.asp> and
recv
<http://msdn.microsoft.com/library/en-us/winsock/winsock/recv_2.asp>
functions both return an integer value of the number of bytes sent or
received, respectively, or an error. Each function also takes the same
parameters: the active socket, a char buffer, the number of bytes to
send or receive, and any flags to use.
From the man page:
The flags parameter is the bitwise OR of zero or more of the following
flags. So if you use 0 does this mean there are no flags? But if i use
one of the flags such as MSG_OOB then I take it the bitwise OR of
MSG_OOB is not equal to 0? For that matter is the bitwise of 0 equal to 0?
Is this right?
In the ballpark?
Or am I still on my own planet?
Thanks for your help,
Peter.
Daniel K. O. wrote:
> Peter Dennis wrote:
>
>> sent = send( datasock, string, strlen( string ), 0);
>>
>> I understand the first 3 parameters but can someone tell me what the
>> '0' is as the fourth parameter to the send function? (it is probably
>> a flag but what does it do? does it mean there are no flags?)
>
>
>
> You can find Winsock documentation at MSDN; you can also Google for a
> .hlp/.chm help file for off-line reference.
> This is from
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/send_2.asp
> :
>
> ---
> int send(
> SOCKET s,
> const char* buf,
> int len,
> int flags
> );
>
> Parameters
>
> s
> [in] Descriptor identifying a connected socket.
> buf
> [in] Buffer containing the data to be transmitted.
> len
> [in] Length of the data in buf, in bytes.
> flags
> [in] Indicator specifying the way in which the call is made.
>
>
> (...)
>
>
> The flags parameter can be used to influence the behavior of the
> function beyond the options specified for the associated socket. The
> semantics of this function are determined by the socket options and
> the flags parameter. The latter is constructed by using the bitwise OR
> operator with any of the following values.
>
> MSG_DONTROUTE Specifies that the data should not be subject to
> routing. A Windows Sockets service provider can choose to ignore this
> flag.
> MSG_OOB Sends OOB data (stream-style socket such as SOCK_STREAM only.
> ---
>
>
> Daniel K. O.
>
>
|