public abstract class SocketImpl extends Object implements SocketOptions
SocketImpl は、実際にソケットを実装するすべてのクラスに共通のスーパークラスです。これはクライアントソケット、サーバーソケットの両方の作成に使用されます。
 「プレーンな」ソケットは、各メソッドを記述のとおりに実装します。ファイアウォールやプロキシは使用しません。
| 修飾子と型 | フィールドと説明 | 
|---|---|
| protected InetAddress | addressこのソケットのリモート側の IP アドレスです。 | 
| protected FileDescriptor | fdこのソケットのファイル記述子オブジェクトです。 | 
| protected int | localportこのソケットの接続先のローカルポート番号です。 | 
| protected int | portこのソケットの接続先のリモートホスト上にあるポート番号です。 | 
IP_MULTICAST_IF, IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS, SO_BINDADDR, SO_BROADCAST, SO_KEEPALIVE, SO_LINGER, SO_OOBINLINE, SO_RCVBUF, SO_REUSEADDR, SO_SNDBUF, SO_TIMEOUT, TCP_NODELAY| コンストラクタと説明 | 
|---|
| SocketImpl() | 
| 修飾子と型 | メソッドと説明 | 
|---|---|
| protected abstract void | accept(SocketImpl s)接続を受け入れます。 | 
| protected abstract int | available()このソケットからブロックなしで読み込めるバイト数を返します。 | 
| protected abstract void | bind(InetAddress host,     int port)指定されたローカルの IP アドレスとポート番号にこのソケットをバインドします。 | 
| protected abstract void | close()このソケットを閉じます。 | 
| protected abstract void | connect(InetAddress address,        int port)指定されたホスト上の指定されたポートにこのソケットを接続します。 | 
| protected abstract void | connect(SocketAddress address,        int timeout)指定されたホスト上の指定されたポートにこのソケットを接続します。 | 
| protected abstract void | connect(String host,        int port)指定されたホスト上の指定されたポートにこのソケットを接続します。 | 
| protected abstract void | create(boolean stream)ストリームソケットまたはデータグラムソケットを作成します。 | 
| protected FileDescriptor | getFileDescriptor()このソケットの  fdフィールドの値を返します。 | 
| protected InetAddress | getInetAddress()このソケットの  addressフィールドの値を返します。 | 
| protected abstract InputStream | getInputStream()このソケットの入力ストリームを返します。 | 
| protected int | getLocalPort()このソケットの  localportフィールドの値を返します。 | 
| protected abstract OutputStream | getOutputStream()このソケットの出力ストリームを返します。 | 
| protected int | getPort()このソケットの  portフィールドの値を返します。 | 
| protected abstract void | listen(int backlog)受信する接続 (接続要求) を入れるキューの最大長を、 count引数に設定します。 | 
| protected abstract void | sendUrgentData(int data)このソケット上で 1 バイトの緊急データを送信します。 | 
| protected void | setPerformancePreferences(int connectionTime,                          int latency,                          int bandwidth)このソケットのパフォーマンス設定を行います。 | 
| protected void | shutdownInput()このソケットの入力ストリームを「ストリームの終わり」に設定します。 | 
| protected void | shutdownOutput()このソケットの出力ストリームを無効にします。 | 
| protected boolean | supportsUrgentData()この SocketImpl が緊急データの送信をサポートするかどうかを返します。 | 
| String | toString()このソケットのアドレスとポートを  Stringとして返します。 | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetOption, setOptionprotected FileDescriptor fd
protected InetAddress address
protected int port
protected int localport
protected abstract void create(boolean stream)
                        throws IOException
stream - true の場合はストリームソケットを作成し、それ以外の場合はデータグラムソケットを作成します。IOException − ソケットの作成中に入出力エラーが発生した場合。protected abstract void connect(String host, int port) throws IOException
host − リモートホスト名。port - ポート番号。IOException − リモートホストへの接続時に入出力エラーが発生した場合。protected abstract void connect(InetAddress address, int port) throws IOException
address − リモートホストの IP アドレス。port - ポート番号。IOException - 接続の試行中に入出力エラーが発生した場合。protected abstract void connect(SocketAddress address, int timeout) throws IOException
address − リモートホストのソケットアドレス。timeout − タイムアウト値 (ミリ秒)。タイムアウトなしの場合は 0。IOException - 接続の試行中に入出力エラーが発生した場合。protected abstract void bind(InetAddress host, int port) throws IOException
host − ローカルインタフェースに属する IP アドレス。port - ポート番号。IOException − このソケットをバインドするときに入出力エラーが発生した場合。protected abstract void listen(int backlog)
                        throws IOException
count 引数に設定します。キューが埋まっているときに接続要求があると、接続は拒否されます。backlog − キューの最大長。IOException − キューの生成中に入出力エラーが発生した場合。protected abstract void accept(SocketImpl s) throws IOException
s − 受け入れる接続。IOException − 接続の受け入れ中に入出力エラーが発生した場合。protected abstract InputStream getInputStream() throws IOException
IOException − 入力ストリームの作成中に入出力エラーが発生した場合。protected abstract OutputStream getOutputStream() throws IOException
IOException − 出力ストリームの作成中に入出力エラーが発生した場合。protected abstract int available()
                          throws IOException
IOException − 使用可能なバイト数の決定時に入出力エラーが発生した場合。protected abstract void close()
                       throws IOException
IOException - このソケットを閉じるときに入出力エラーが発生した場合。protected void shutdownInput()
                      throws IOException
IOException - このソケットを停止するときに入出力エラーが発生した場合。Socket.shutdownOutput(), Socket.close(), Socket.setSoLinger(boolean, int)protected void shutdownOutput()
                       throws IOException
IOException - このソケットを停止するときに入出力エラーが発生した場合。Socket.shutdownInput(), Socket.close(), Socket.setSoLinger(boolean, int)protected FileDescriptor getFileDescriptor()
fd フィールドの値を返します。fd フィールドの値。fdprotected InetAddress getInetAddress()
address フィールドの値を返します。address フィールドの値。addressprotected int getPort()
port フィールドの値を返します。port フィールドの値。portprotected boolean supportsUrgentData()
addressprotected abstract void sendUrgentData(int data)
                                throws IOException
data - 送信するデータのバイトIOException - データ送信時にエラーが発生した場合。protected int getLocalPort()
localport フィールドの値を返します。localport フィールドの値。localportpublic String toString()
String として返します。protected void setPerformancePreferences(int connectionTime,
                             int latency,
                             int bandwidth)
ソケットはデフォルトで、TCP/IP プロトコルを使用します。実装によっては、TCP/IP とは異なるパフォーマンス特性を持つ代替プロトコルを提供することもあります。アプリケーションは、このメソッドを使用することで、実装で利用可能なプロトコルの選択時に、これらのかね合いの取り方を示す独自の設定を表現できます。
パフォーマンス設定は、接続時間の短さ、応答時間の速さ、および帯域幅の広さの相対的な重要度を示す 3 つの整数値によって記述されます。これらの整数の絶対値は重要ではありません。ある特定のプロトコルを選択するために、これらの値が単純に比較されますが、その際、値が大きければより強い設定を示します。負の値は正の値よりも低い優先順位を表します。たとえば、アプリケーションが応答時間の速さや帯域幅の広さよりも接続時間の短さを優先する場合には、値 (1, 0, 0) を指定してこのメソッドを呼び出すことができます。アプリケーションが応答時間の速さよりも帯域幅の広さを優先し、接続時間の短さよりも応答時間の速さを優先する場合には、値 (0, 1, 2) を指定してこのメソッドを呼び出すことができます。 このメソッドは、サブクラス内でオーバーライドされていないかぎり、デフォルトでは何もしません。
connectionTime - 接続時間の短さの相対的な重要度を表す intlatency - 応答時間の速さの相対的な重要度を表す intbandwidth - 帯域幅の広さの相対的な重要度を表す int バグまたは機能を送信 
詳細な API リファレンスおよび開発者ドキュメントについては、Java SE のドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.