< prev index next >

src/java.base/share/classes/java/net/SocketImpl.java

Print this page




 263     /**
 264      * Send one byte of urgent data on the socket.
 265      * The byte to be sent is the low eight bits of the parameter
 266      * @param data The byte of data to send
 267      * @exception IOException if there is an error
 268      *  sending the data.
 269      * @since 1.4
 270      */
 271     protected abstract void sendUrgentData (int data) throws IOException;
 272 
 273     /**
 274      * Returns the value of this socket's {@code localport} field.
 275      *
 276      * @return  the value of this socket's {@code localport} field.
 277      * @see     java.net.SocketImpl#localport
 278      */
 279     protected int getLocalPort() {
 280         return localport;
 281     }
 282 
 283     void setSocket(Socket soc) {




 284         this.socket = soc;
 285     }
 286 
 287     Socket getSocket() {
 288         return socket;
 289     }
 290 
 291     void setServerSocket(ServerSocket soc) {




 292         this.serverSocket = soc;
 293     }
 294 
 295     ServerSocket getServerSocket() {
 296         return serverSocket;
 297     }
 298 
 299     /**
 300      * Returns the address and port of this socket as a {@code String}.
 301      *
 302      * @return  a string representation of this socket.
 303      */
 304     public String toString() {
 305         return "Socket[addr=" + getInetAddress() +
 306             ",port=" + getPort() + ",localport=" + getLocalPort()  + "]";
 307     }
 308 
 309     void reset() throws IOException {
 310         address = null;
 311         port = 0;




 263     /**
 264      * Send one byte of urgent data on the socket.
 265      * The byte to be sent is the low eight bits of the parameter
 266      * @param data The byte of data to send
 267      * @exception IOException if there is an error
 268      *  sending the data.
 269      * @since 1.4
 270      */
 271     protected abstract void sendUrgentData (int data) throws IOException;
 272 
 273     /**
 274      * Returns the value of this socket's {@code localport} field.
 275      *
 276      * @return  the value of this socket's {@code localport} field.
 277      * @see     java.net.SocketImpl#localport
 278      */
 279     protected int getLocalPort() {
 280         return localport;
 281     }
 282 
 283     /**
 284      * Set the Socket object
 285      * @param soc the socket
 286      */
 287     protected void setSocket(Socket soc) {
 288         this.socket = soc;
 289     }
 290 
 291     Socket getSocket() {
 292         return socket;
 293     }
 294 
 295     /**
 296      * Set the ServerSocket object
 297      * @param soc the socket
 298      */
 299     protected void setServerSocket(ServerSocket soc) {
 300         this.serverSocket = soc;
 301     }
 302 
 303     ServerSocket getServerSocket() {
 304         return serverSocket;
 305     }
 306 
 307     /**
 308      * Returns the address and port of this socket as a {@code String}.
 309      *
 310      * @return  a string representation of this socket.
 311      */
 312     public String toString() {
 313         return "Socket[addr=" + getInetAddress() +
 314             ",port=" + getPort() + ",localport=" + getLocalPort()  + "]";
 315     }
 316 
 317     void reset() throws IOException {
 318         address = null;
 319         port = 0;


< prev index next >