[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 2

splice Subroutine

Purpose

Lets the protocol stack manage two sockets that use TCP.

Syntax


#include <sys/types.h>
#include <sys/socket.h>


int splice(socket1, socket2, flags)
int socket1, socket2;
int flags;

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

socket1, socket2 Specifies a socket that had gone through a successful connect() or accept().
flags Set to zero. Currently ignored.

Return Values

0 Indicates a successful completion.
-1 Indicates an error. The specific error is indicated by errno.

Error Codes

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.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]