| java.lang.Object org.apache.tomcat.jni.Socket
Socket | public class Socket (Code) | | Socket
author: Mladen Turk version: $Revision: 467222 $, $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $ |
Method Summary | |
native public static long | accept(long sock) Accept a new connection request
Parameters: sock - The socket we are listening on. Parameters: pool - The pool for the new socket. | native public static int | acceptfilter(long sock, String name, String args) Set an OS level accept filter.
Parameters: sock - The socket to put the accept filter on. Parameters: name - The accept filter Parameters: args - Any extra args to the accept filter. | native public static boolean | atmark(long sock) | native public static int | bind(long sock, long sa) | native public static int | close(long thesocket) Close a socket. | native public static int | connect(long sock, long sa) Issue a connection request to a socket either on the same machine
or a different one. | native public static long | create(int family, int type, int protocol, long cont) Create a socket. | native public static void | destroy(long thesocket) | native public static int | listen(long sock, int backlog) Listen to a bound socket for connections.
Parameters: sock - The socket to listen on Parameters: backlog - The number of outstanding connections allowed in the socketslisten queue. | native public static int | optGet(long sock, int opt) Query socket options for the specified socket
Parameters: sock - The socket to query Parameters: opt - The option we would like to query. | native public static int | optSet(long sock, int opt, int on) Setup socket options for the specified socket
Parameters: sock - The socket to set up. Parameters: opt - The option we would like to configure. | native public static long | pool(long thesocket) Create a child pool from associated socket pool. | native public static int | recv(long sock, byte[] buf, int offset, int nbytes) Read data from a network.
This functions acts like a blocking read by default. | native public static int | recvFrom(long from, long sock, int flags, byte[] buf, int offset, int nbytes) Parameters: from - The apr_sockaddr_t to fill in the recipient info Parameters: sock - The socket to use Parameters: flags - The flags to use Parameters: buf - The buffer to use Parameters: offset - Offset in the byte buffer. Parameters: nbytes - The number of bytes to read (-1) for full array. | native public static int | recvb(long sock, ByteBuffer buf, int offset, int nbytes) Read data from a network.
This functions acts like a blocking read by default. | native public static int | recvbb(long sock, int offset, int nbytes) | native public static int | recvbbt(long sock, int offset, int nbytes, long timeout) | native public static int | recvbt(long sock, ByteBuffer buf, int offset, int nbytes, long timeout) Read data from a network with timeout.
This functions acts like a blocking read by default. | native public static int | recvt(long sock, byte[] buf, int offset, int nbytes, long timeout) Read data from a network with timeout.
This functions acts like a blocking read by default. | native public static int | send(long sock, byte[] buf, int offset, int len) Send data over a network.
This functions acts like a blocking write by default. | native public static int | sendb(long sock, ByteBuffer buf, int offset, int len) Send data over a network.
This functions acts like a blocking write by default. | native public static int | sendbb(long sock, int offset, int len) | native public static long | sendfile(long sock, long file, byte[][] headers, byte[][] trailers, long offset, long len, int flags) Send a file from an open file descriptor to a socket, along with
optional headers and trailers.
This functions acts like a blocking write by default. | native public static long | sendfilen(long sock, long file, long offset, long len, int flags) Send a file without header and trailer arrays. | native public static int | sendto(long sock, long where, int flags, byte[] buf, int offset, int len) | native public static int | sendv(long sock, byte[][] vec) Send multiple packets of data over a network.
This functions acts like a blocking write by default. | native public static void | setrbb(long sock, ByteBuffer buf) Set internal receive ByteBuffer. | native public static void | setsbb(long sock, ByteBuffer buf) Set internal send ByteBuffer. | native public static int | shutdown(long thesocket, int how) Shutdown either reading, writing, or both sides of a socket.
This does not actually close the socket descriptor, it just
controls which calls are still valid on the socket.
Parameters: thesocket - The socket to close Parameters: how - How to shutdown the socket. | native public static long | timeoutGet(long sock) | native public static int | timeoutSet(long sock, long t) |
APR_INCOMPLETE_READ | final public static int APR_INCOMPLETE_READ(Code) | | Set on non-blocking sockets (timeout != 0) on which the
previous read() did not fill a buffer completely. the next
apr_socket_recv() will first call select()/poll() rather than
going straight into read(). (Can also be set by an application to
force a select()/poll() call before the next read, in cases where
the app expects that an immediate read would fail.)
|
APR_INCOMPLETE_WRITE | final public static int APR_INCOMPLETE_WRITE(Code) | | like APR_INCOMPLETE_READ, but for write
|
APR_INET | final public static int APR_INET(Code) | | |
APR_INET6 | final public static int APR_INET6(Code) | | |
APR_IPV4_ADDR_OK | final public static int APR_IPV4_ADDR_OK(Code) | | no longer allow read or write requests
|
APR_IPV6_ADDR_OK | final public static int APR_IPV6_ADDR_OK(Code) | | |
APR_IPV6_V6ONLY | final public static int APR_IPV6_V6ONLY(Code) | | Don't accept IPv4 connections on an IPv6 listening socket.
|
APR_LOCAL | final public static int APR_LOCAL(Code) | | Enum to tell us if we're interested in remote or local socket
apr_interface_e
|
APR_PROTO_SCTP | final public static int APR_PROTO_SCTP(Code) | | UDP
|
APR_PROTO_TCP | final public static int APR_PROTO_TCP(Code) | | |
APR_PROTO_UDP | final public static int APR_PROTO_UDP(Code) | | TCP
|
APR_REMOTE | final public static int APR_REMOTE(Code) | | |
APR_RESET_NODELAY | final public static int APR_RESET_NODELAY(Code) | | This flag is ONLY set internally when we set APR_TCP_NOPUSH with
APR_TCP_NODELAY set to tell us that APR_TCP_NODELAY should be turned on
again when NOPUSH is turned off
|
APR_SHUTDOWN_READ | final public static int APR_SHUTDOWN_READ(Code) | | Define what type of socket shutdown should occur.
apr_shutdown_how_e enum
|
APR_SHUTDOWN_READWRITE | final public static int APR_SHUTDOWN_READWRITE(Code) | | no longer allow write requests
|
APR_SHUTDOWN_WRITE | final public static int APR_SHUTDOWN_WRITE(Code) | | no longer allow read request
|
APR_SO_DEBUG | final public static int APR_SO_DEBUG(Code) | | Keepalive
|
APR_SO_DISCONNECTED | final public static int APR_SO_DISCONNECTED(Code) | | Receive buffer
|
APR_SO_KEEPALIVE | final public static int APR_SO_KEEPALIVE(Code) | | Linger
|
APR_SO_LINGER | final public static int APR_SO_LINGER(Code) | | |
APR_SO_NONBLOCK | final public static int APR_SO_NONBLOCK(Code) | | Debug
|
APR_SO_RCVBUF | final public static int APR_SO_RCVBUF(Code) | | Send buffer
|
APR_SO_REUSEADDR | final public static int APR_SO_REUSEADDR(Code) | | Non-blocking IO
|
APR_SO_SNDBUF | final public static int APR_SO_SNDBUF(Code) | | Reuse addresses
|
APR_TCP_DEFER_ACCEPT | final public static int APR_TCP_DEFER_ACCEPT(Code) | | Delay accepting of new connections until data is available.
|
APR_TCP_NODELAY | final public static int APR_TCP_NODELAY(Code) | | For SCTP sockets, this is mapped to STCP_NODELAY internally.
|
APR_TCP_NOPUSH | final public static int APR_TCP_NOPUSH(Code) | | |
APR_UNSPEC | final public static int APR_UNSPEC(Code) | | |
SOCKET_GET_APRS | final public static int SOCKET_GET_APRS(Code) | | |
SOCKET_GET_IMPL | final public static int SOCKET_GET_IMPL(Code) | | |
SOCKET_GET_POOL | final public static int SOCKET_GET_POOL(Code) | | |
SOCKET_GET_TYPE | final public static int SOCKET_GET_TYPE(Code) | | |
SOCK_DGRAM | final public static int SOCK_DGRAM(Code) | | |
SOCK_STREAM | final public static int SOCK_STREAM(Code) | | |
accept | native public static long accept(long sock) throws Exception(Code) | | Accept a new connection request
Parameters: sock - The socket we are listening on. Parameters: pool - The pool for the new socket. A copy of the socket that is connected to the socket thatmade the connection request. This is the socket which shouldbe used for all future communication. |
acceptfilter | native public static int acceptfilter(long sock, String name, String args)(Code) | | Set an OS level accept filter.
Parameters: sock - The socket to put the accept filter on. Parameters: name - The accept filter Parameters: args - Any extra args to the accept filter. Passing NULL here removesthe accept filter. |
atmark | native public static boolean atmark(long sock)(Code) | | Query the specified socket if at the OOB/Urgent data mark
Parameters: sock - The socket to query True if socket is at the OOB/urgent mark,otherwise return false. |
bind | native public static int bind(long sock, long sa)(Code) | | Bind the socket to its associated port
Parameters: sock - The socket to bind Parameters: sa - The socket address to bind toThis may be where we will find out if there is any other processusing the selected port. |
close | native public static int close(long thesocket)(Code) | | Close a socket.
Parameters: thesocket - The socket to close |
connect | native public static int connect(long sock, long sa)(Code) | | Issue a connection request to a socket either on the same machine
or a different one.
Parameters: sock - The socket we wish to use for our side of the connection Parameters: sa - The address of the machine we wish to connect to. |
create | native public static long create(int family, int type, int protocol, long cont) throws Exception(Code) | | Create a socket.
Parameters: family - The address family of the socket (e.g., APR_INET). Parameters: type - The type of the socket (e.g., SOCK_STREAM). Parameters: protocol - The protocol of the socket (e.g., APR_PROTO_TCP). Parameters: cont - The parent pool to use The new socket that has been set up. |
destroy | native public static void destroy(long thesocket)(Code) | | Destroy a pool associated with socket
Parameters: thesocket - The destroy |
listen | native public static int listen(long sock, int backlog)(Code) | | Listen to a bound socket for connections.
Parameters: sock - The socket to listen on Parameters: backlog - The number of outstanding connections allowed in the socketslisten queue. If this value is less than zero, the listenqueue size is set to zero. |
optGet | native public static int optGet(long sock, int opt) throws Exception(Code) | | Query socket options for the specified socket
Parameters: sock - The socket to query Parameters: opt - The option we would like to query. One of:APR_SO_DEBUG -- turn on debugging informationAPR_SO_KEEPALIVE -- keep connections activeAPR_SO_LINGER -- lingers on close if data is presentAPR_SO_NONBLOCK -- Turns blocking on/off for socketAPR_SO_REUSEADDR -- The rules used in validating addressessupplied to bind should allow reuseof local addresses.APR_SO_SNDBUF -- Set the SendBufferSizeAPR_SO_RCVBUF -- Set the ReceiveBufferSizeAPR_SO_DISCONNECTED -- Query the disconnected state of the socket.(Currently only used on Windows) Socket option returned on the call. |
optSet | native public static int optSet(long sock, int opt, int on)(Code) | | Setup socket options for the specified socket
Parameters: sock - The socket to set up. Parameters: opt - The option we would like to configure. One of:APR_SO_DEBUG -- turn on debugging informationAPR_SO_KEEPALIVE -- keep connections activeAPR_SO_LINGER -- lingers on close if data is presentAPR_SO_NONBLOCK -- Turns blocking on/off for socketWhen this option is enabled, usethe APR_STATUS_IS_EAGAIN() macro tosee if a send or receive functioncould not transfer data withoutblocking.APR_SO_REUSEADDR -- The rules used in validating addressessupplied to bind should allow reuseof local addresses.APR_SO_SNDBUF -- Set the SendBufferSizeAPR_SO_RCVBUF -- Set the ReceiveBufferSize Parameters: on - Value for the option. |
pool | native public static long pool(long thesocket) throws Exception(Code) | | Create a child pool from associated socket pool.
Parameters: thesocket - The socket to use |
recv | native public static int recv(long sock, byte[] buf, int offset, int nbytes)(Code) | | Read data from a network.
This functions acts like a blocking read by default. To change
this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
socket option.
The number of bytes actually received is stored in argument 3.
It is possible for both bytes to be received and an APR_EOF or
other error to be returned.
APR_EINTR is never returned.
Parameters: sock - The socket to read the data from. Parameters: buf - The buffer to store the data in. Parameters: offset - Offset in the byte buffer. Parameters: nbytes - The number of bytes to read (-1) for full array. the number of bytes received. |
recvFrom | native public static int recvFrom(long from, long sock, int flags, byte[] buf, int offset, int nbytes)(Code) | | Parameters: from - The apr_sockaddr_t to fill in the recipient info Parameters: sock - The socket to use Parameters: flags - The flags to use Parameters: buf - The buffer to use Parameters: offset - Offset in the byte buffer. Parameters: nbytes - The number of bytes to read (-1) for full array. the number of bytes received. |
recvb | native public static int recvb(long sock, ByteBuffer buf, int offset, int nbytes)(Code) | | Read data from a network.
This functions acts like a blocking read by default. To change
this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
socket option.
The number of bytes actually received is stored in argument 3.
It is possible for both bytes to be received and an APR_EOF or
other error to be returned.
APR_EINTR is never returned.
Parameters: sock - The socket to read the data from. Parameters: buf - The buffer to store the data in. Parameters: offset - Offset in the byte buffer. Parameters: nbytes - The number of bytes to read (-1) for full array. the number of bytes received. |
recvbb | native public static int recvbb(long sock, int offset, int nbytes)(Code) | | Read data from a network using internally set ByteBuffer
|
recvbbt | native public static int recvbbt(long sock, int offset, int nbytes, long timeout)(Code) | | Read data from a network with timeout using internally set ByteBuffer
|
recvbt | native public static int recvbt(long sock, ByteBuffer buf, int offset, int nbytes, long timeout)(Code) | | Read data from a network with timeout.
This functions acts like a blocking read by default. To change
this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
socket option.
The number of bytes actually received is stored in argument 3.
It is possible for both bytes to be received and an APR_EOF or
other error to be returned.
APR_EINTR is never returned.
Parameters: sock - The socket to read the data from. Parameters: buf - The buffer to store the data in. Parameters: offset - Offset in the byte buffer. Parameters: nbytes - The number of bytes to read (-1) for full array. Parameters: timeout - The socket timeout in microseconds. the number of bytes received. |
recvt | native public static int recvt(long sock, byte[] buf, int offset, int nbytes, long timeout)(Code) | | Read data from a network with timeout.
This functions acts like a blocking read by default. To change
this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
socket option.
The number of bytes actually received is stored in argument 3.
It is possible for both bytes to be received and an APR_EOF or
other error to be returned.
APR_EINTR is never returned.
Parameters: sock - The socket to read the data from. Parameters: buf - The buffer to store the data in. Parameters: offset - Offset in the byte buffer. Parameters: nbytes - The number of bytes to read (-1) for full array. Parameters: timeout - The socket timeout in microseconds. the number of bytes received. |
send | native public static int send(long sock, byte[] buf, int offset, int len)(Code) | | Send data over a network.
This functions acts like a blocking write by default. To change
this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
socket option.
It is possible for both bytes to be sent and an error to be returned.
APR_EINTR is never returned.
Parameters: sock - The socket to send the data over. Parameters: buf - The buffer which contains the data to be sent. Parameters: offset - Offset in the byte buffer. Parameters: len - The number of bytes to write; (-1) for full array. The number of bytes send. |
sendb | native public static int sendb(long sock, ByteBuffer buf, int offset, int len)(Code) | | Send data over a network.
This functions acts like a blocking write by default. To change
this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
socket option.
It is possible for both bytes to be sent and an error to be returned.
APR_EINTR is never returned.
Parameters: sock - The socket to send the data over. Parameters: buf - The Byte buffer which contains the data to be sent. Parameters: offset - The offset within the buffer array of the first buffer fromwhich bytes are to be retrieved; must be non-negativeand no larger than buf.length Parameters: len - The maximum number of buffers to be accessed; must be non-negativeand no larger than buf.length - offset The number of bytes send. |
sendbb | native public static int sendbb(long sock, int offset, int len)(Code) | | Send data over a network using internally set ByteBuffer
|
sendfile | native public static long sendfile(long sock, long file, byte[][] headers, byte[][] trailers, long offset, long len, int flags)(Code) | | Send a file from an open file descriptor to a socket, along with
optional headers and trailers.
This functions acts like a blocking write by default. To change
this behavior, use apr_socket_timeout_set() or the
APR_SO_NONBLOCK socket option.
The number of bytes actually sent is stored in the len parameter.
The offset parameter is passed by reference for no reason; its
value will never be modified by the apr_socket_sendfile() function.
Parameters: sock - The socket to which we're writing Parameters: file - The open file from which to read Parameters: headers - Array containing the headers to send Parameters: trailers - Array containing the trailers to send Parameters: offset - Offset into the file where we should begin writing Parameters: len - Number of bytes to send from the file Parameters: flags - APR flags that are mapped to OS specific flags Number of bytes actually sent, including headers,file, and trailers |
sendfilen | native public static long sendfilen(long sock, long file, long offset, long len, int flags)(Code) | | Send a file without header and trailer arrays.
|
sendto | native public static int sendto(long sock, long where, int flags, byte[] buf, int offset, int len)(Code) | | Parameters: sock - The socket to send from Parameters: where - The apr_sockaddr_t describing where to send the data Parameters: flags - The flags to use Parameters: buf - The data to send Parameters: offset - Offset in the byte buffer. Parameters: len - The length of the data to send |
sendv | native public static int sendv(long sock, byte[][] vec)(Code) | | Send multiple packets of data over a network.
This functions acts like a blocking write by default. To change
this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
socket option.
The number of bytes actually sent is stored in argument 3.
It is possible for both bytes to be sent and an error to be returned.
APR_EINTR is never returned.
Parameters: sock - The socket to send the data over. Parameters: vec - The array from which to get the data to send. |
setrbb | native public static void setrbb(long sock, ByteBuffer buf)(Code) | | Set internal receive ByteBuffer.
This function will preset internal Java ByteBuffer for
consecutive revcvbb/recvbbt calls.
Parameters: thesocket - The socket to use Parameters: buf - The ByteBuffer |
setsbb | native public static void setsbb(long sock, ByteBuffer buf)(Code) | | Set internal send ByteBuffer.
This function will preset internal Java ByteBuffer for
consecutive sendbb calls.
Parameters: thesocket - The socket to use Parameters: buf - The ByteBuffer |
shutdown | native public static int shutdown(long thesocket, int how)(Code) | | Shutdown either reading, writing, or both sides of a socket.
This does not actually close the socket descriptor, it just
controls which calls are still valid on the socket.
Parameters: thesocket - The socket to close Parameters: how - How to shutdown the socket. One of:APR_SHUTDOWN_READ no longer allow read requestsAPR_SHUTDOWN_WRITE no longer allow write requestsAPR_SHUTDOWN_READWRITE no longer allow read or write requests |
timeoutGet | native public static long timeoutGet(long sock) throws Exception(Code) | | Query socket timeout for the specified socket
Parameters: sock - The socket to query Socket timeout returned from the query. |
timeoutSet | native public static int timeoutSet(long sock, long t)(Code) | | Setup socket timeout for the specified socket
Parameters: sock - The socket to set up. Parameters: t - Value for the timeout in microseconds.t > 0 -- read and write calls return APR_TIMEUP if specified timeelapsess with no data read or writtent == 0 -- read and write calls never blockt < 0 -- read and write calls block |
|
|