1:
37:
38:
39: package ;
40:
41: import ;
42:
43: import ;
44: import ;
45: import ;
46: import ;
47:
48: public final class LocalServerSocket extends ServerSocket
49: {
50:
51:
52:
53:
54: private LocalSocketImpl myImpl;
55: private boolean closed;
56:
57:
58:
59:
60: public LocalServerSocket () throws IOException
61: {
62: myImpl = new LocalSocketImpl ();
63: }
64:
65: public LocalServerSocket (SocketAddress bindPoint) throws IOException
66: {
67: this ();
68: bind (bindPoint);
69: }
70:
71:
72:
73:
74: public void bind (SocketAddress bindPoint) throws IOException
75: {
76: bind (bindPoint, 0);
77: }
78:
79: public void bind (SocketAddress bindPoint, int backlog) throws IOException
80: {
81: myImpl.doCreate ();
82: myImpl.bind (bindPoint);
83: myImpl.listen (backlog);
84: }
85:
86: public InetAddress getInetAddress ()
87: {
88: return null;
89: }
90:
91: public int getLocalPort ()
92: {
93: return -1;
94: }
95:
96: public SocketAddress getLocalSocketAddress ()
97: {
98: return myImpl.getLocalAddress ();
99: }
100:
101: public Socket accept () throws IOException
102: {
103: LocalSocket s = new LocalSocket (true);
104: myImpl.accept (s.getLocalImpl());
105: s.localConnected = true;
106: return s;
107: }
108:
109: public void close () throws IOException
110: {
111: myImpl.close ();
112: myImpl.unlink ();
113: closed = true;
114: }
115:
116: public boolean isBound ()
117: {
118: return myImpl.getLocalAddress () != null;
119: }
120:
121: public boolean isClosed ()
122: {
123: return closed;
124: }
125:
126: public void setSoTimeout (int timeout)
127: {
128: throw new UnsupportedOperationException ("local sockets do not support timeouts");
129: }
130:
131: public int getSoTimeout ()
132: {
133: throw new UnsupportedOperationException ("local sockets do not support timeouts");
134: }
135:
136: public void setReuseAddress (boolean b)
137: {
138: throw new UnsupportedOperationException ("local sockets do not support reuse address");
139: }
140:
141: public boolean getReuseAddress ()
142: {
143: throw new UnsupportedOperationException ("local sockets do not support reuse address");
144: }
145:
146: public String toString ()
147: {
148: return LocalServerSocket.class.getName() + " [ address="
149: + myImpl.getLocalAddress() + " ]";
150: }
151:
152: public void setReceiveBufferSize (int size)
153: {
154: throw new UnsupportedOperationException ("local sockets do not support buffer size");
155: }
156:
157: public int getReceiveBufferSize ()
158: {
159: throw new UnsupportedOperationException ("local sockets do not support buffer size");
160: }
161:
162: public void setSendBufferSize (int size)
163: {
164: throw new UnsupportedOperationException ("local sockets do not support buffer size");
165: }
166:
167: public int getSendBufferSize ()
168: {
169: throw new UnsupportedOperationException ("local sockets do not support buffer size");
170: }
171: }