splice Subroutine
Purpose
Lets the protocol stack manage two sockets that use TCP.
Syntax
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/socket.h>
Description
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.
Parameters
Item | Description |
---|---|
socket1, socket2 | Specifies a socket that had gone through a successful connect() or accept(). |
flags | Set to zero. Currently ignored. |
Return Values
Item | Description |
---|---|
0 | Indicates a successful completion. |
-1 | Indicates an error. The specific error is indicated by errno. |
Error Codes
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. |