Lets the protocol stack manage two sockets that use TCP.
#include <sys/types.h>
#include <sys/socket.h>
int splice(socket1, socket2, flags)
int socket1, socket2;
int flags;
The splice subroutine will let TCP manage two sockets that are in connected state thus relieving the caller from moving data from one socket to another. After the splice subroutine returns successfully, the caller needs to close the two sockets.
The two sockets should be of type SOCK_STREAM and protocol IPPROTO_TCP. Specifying a protocol of zero will also work.
Item | Description |
---|---|
socket1, socket2 | Specifies a socket that had gone through a successful connect() or accept(). |
flags | Set to zero. Currently ignored. |
Item | Description |
---|---|
0 | Indicates a successful completion. |
-1 | Indicates an error. The specific error is indicated by errno. |
Item | Description |
---|---|
EBADF | socket1 or socket2 is not valid. |
ENOTSOCK | socket1 or socket2 refers to a file, not a socket. |
EOPNOTSUPP | socket1 or socket2 is not of type SOCK_STREAM. |
EINVAL | The parameters are invalid. |
EEXIST | socket1 or socket2 is already spliced. |
ENOTCONN | socket1 or socket2 is not in connected state. |
EAFNOSUPPORT | socket1 or socket2 address family is not supported for this subroutine. |