Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Flags in send() and recv() function SOCKETS

bpajkbpajk Posts: 156Member
What do the flags in the send() and recv() mean, when and how can I use them. I allways use 0 as a flag parameter.
Here is the reference:

15 Recv
Declaration
Function Recv (Sock:Longint;Var Addr;AddrLen,Flags:Longint) : Longint;

Description
Recv reads at most Addrlen bytes from socket Sock into address Addr. The socket must be in a connected state. Flags can be one of the following:
1
: Process out-of band data.
4
: Bypass routing, use a direct interface.
??
: Wait for full request or report an error.
The functions returns the number of bytes actually read from the socket, or -1 if a detectable error occurred.

Comments

  • ManningManning Posts: 1,621Member
    : What do the flags in the send() and recv() mean, when and how can I use them. I allways use 0 as a flag parameter.

    It's largely protocol dependant, this is just what I know with TCP. With both send() and recv() you can use the MSG_OOB flag, which is most commonly used to send "urgent" data. On recv() you can also use the MSG_PEEK flag which will read the incoming data, but not remove it from the buffer.

    If you look on MSDN you might find some other options as well.
  • bpajkbpajk Posts: 156Member
    Thanx, that realy helped me a lot.
Sign In or Register to comment.