01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package java.net;
19:
20: /**
21: * Defines the protocol to get & set Socket options.
22: */
23: public interface SocketOptions {
24:
25: public static final int SO_LINGER = 128;
26:
27: public static final int SO_TIMEOUT = 4102;
28:
29: public static final int TCP_NODELAY = 1;
30:
31: // For 5 and 6 see MulticastSocket
32:
33: // For 7 see PlainDatagramSocketImpl
34:
35: public static final int IP_MULTICAST_IF = 16;
36:
37: public static final int SO_BINDADDR = 15;
38:
39: public static final int SO_REUSEADDR = 4;
40:
41: // 10 not currently used
42:
43: public static final int SO_SNDBUF = 4097;
44:
45: public static final int SO_RCVBUF = 4098;
46:
47: // For 13, see DatagramSocket
48:
49: public static final int SO_KEEPALIVE = 8;
50:
51: public static final int IP_TOS = 3;
52:
53: public static final int IP_MULTICAST_LOOP = 18;
54:
55: public static final int SO_BROADCAST = 32;
56:
57: public static final int SO_OOBINLINE = 4099;
58:
59: public static final int IP_MULTICAST_IF2 = 31;
60:
61: /**
62: * Answer the declared socket option.
63: *
64: * @return Object the option value
65: * @param optID
66: * the option identifier
67: * @exception SocketException
68: * thrown if an error occurs getting the option
69: */
70: public Object getOption(int optID) throws SocketException;
71:
72: /**
73: * Set the declared socket option to the value.
74: *
75: * @param optID
76: * the option identifier
77: * @param val
78: * the option value to be set
79: * @exception SocketException
80: * thrown if an error occurs setting the option
81: */
82: public void setOption(int optID, Object val) throws SocketException;
83: }
|