Java プラットフォーム 1.2

java.net
クラス SocketImpl

java.lang.Object
  |
  +--java.net.SocketImpl

public abstract class SocketImpl
extends Object
implements SocketOptions

抽象クラス SocketImpl は、ソケットを実際に実装するすべてのクラスに共通のスーパークラスです。クライアントソケットとサーバソケットの両方を作成する際に使用されます。

「プレーンな」ソケットは、各メソッドを記述のとおりに実装します。ファイアウォールやプロキシは使用しません。

導入されたバージョン:
JDK1.0

フィールドの概要
protected  InetAddress address
          このソケットのリモート側の IP アドレスです。
protected  FileDescriptor fd
          このソケットのファイル記述子オブジェクトです。
protected  int localport
          このソケットの接続先のローカルポート番号です。
protected  int port
          このソケットの接続先のリモートホスト上にあるポート番号です。
 
コンストラクタの概要
SocketImpl()
           
 
メソッドの概要
protected abstract  void accept(SocketImpl s)
          接続を受け入れます。
protected abstract  int available()
          このソケットからブロックなしで読み込めるバイト数を返します。
protected abstract  void bind(InetAddress host, int port)
          指定されたホスト上の指定されたポート番号にこのソケットをバインドします。
protected abstract  void close()
          このソケットを閉じます。
protected abstract  void connect(InetAddress address, int port)
          指定されたホスト上の指定されたポートにこのソケットを接続します。
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 引数の値に設定します。
 String toString()
          このソケットのアドレスとポートを String として返します。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

fd

protected FileDescriptor fd
このソケットのファイル記述子オブジェクトです。

address

protected InetAddress address
このソケットのリモート側の IP アドレスです。

port

protected int port
このソケットの接続先のリモートホスト上にあるポート番号です。

localport

protected int localport
このソケットの接続先のローカルポート番号です。
コンストラクタの詳細

SocketImpl

public SocketImpl()
メソッドの詳細

create

protected abstract void create(boolean stream)
                        throws IOException
ストリームソケットまたはデータグラムソケットを作成します。
パラメータ:
stream - true を指定した場合はストリームソケットが作成され、そうでない場合はデータグラムソケットが作成される
例外:
IOException - ソケットの作成中に入出力エラーが発生した場合

connect

protected abstract void connect(String host,
                                int port)
                         throws IOException
指定されたホスト上の指定されたポートにこのソケットを接続します。
パラメータ:
host - リモートホスト名
port - ポート番号
例外:
IOException - リモートホストへの接続中に入出力エラーが発生した場合

connect

protected abstract void connect(InetAddress address,
                                int port)
                         throws IOException
指定されたホスト上の指定されたポートにこのソケットを接続します。
パラメータ:
address - リモートホストの IP アドレス
port - ポート番号
例外:
IOException - 接続の試行中に入出力エラーが発生した場合

bind

protected abstract void bind(InetAddress host,
                             int port)
                      throws IOException
指定されたホスト上の指定されたポート番号にこのソケットをバインドします。
パラメータ:
host - リモートホストの IP アドレス
port - ポート番号
例外:
IOException - このソケットのバインド中に入出力エラーが発生した場合

listen

protected abstract void listen(int backlog)
                        throws IOException
受信する接続 (接続要求) を入れる待ち行列の最大長を、count 引数の値に設定します。待ち行列が埋まっているときに接続要求があると、接続は拒否されます。
パラメータ:
backlog - 待ち行列の最大長
例外:
IOException - 待ち行列の作成中に入出力エラーが発生した場合

accept

protected abstract void accept(SocketImpl s)
                        throws IOException
接続を受け入れます。
パラメータ:
s - 受け入れる接続
例外:
IOException - 接続の受け入れ中に入出力エラーが発生した場合

getInputStream

protected abstract InputStream getInputStream()
                                       throws IOException
このソケットの入力ストリームを返します。
戻り値:
このソケットからの入力を読み込むためのストリーム
例外:
IOException - 入力ストリームの作成中に入出力エラーが発生した場合

getOutputStream

protected abstract OutputStream getOutputStream()
                                         throws IOException
このソケットの出力ストリームを返します。
戻り値:
このソケットに出力を書き込むためのストリーム
例外:
IOException - 入力ストリームの作成中に入出力エラーが発生した場合

available

protected abstract int available()
                          throws IOException
このソケットからブロックなしで読み込めるバイト数を返します。
戻り値:
このソケットからブロックなしで読み込めるバイト数
例外:
IOException - 利用できるバイト数の決定時に入出力エラーが発生した場合

close

protected abstract void close()
                       throws IOException
このソケットを閉じます。
例外:
IOException - このソケットを閉じているときに入出力エラーが発生した場合

getFileDescriptor

protected FileDescriptor getFileDescriptor()
このソケットの fd フィールド値を返します。
戻り値:
このソケットの fd フィールド値
関連項目:
fd

getInetAddress

protected InetAddress getInetAddress()
このソケットの address フィールド値を返します。
戻り値:
このソケットの address フィールド値
関連項目:
address

getPort

protected int getPort()
このソケットの port フィールド値を返します。
戻り値:
このソケットの port フィールド値
関連項目:
port

getLocalPort

protected int getLocalPort()
このソケットの localport フィールド値を返します。
戻り値:
このソケットの localport フィールド値
関連項目:
localport

toString

public String toString()
このソケットのアドレスとポートを String として返します。
戻り値:
このソケットの文字列表現
オーバーライド:
クラス Object 内の toString

Java プラットフォーム 1.2

バグや機能要求の報告
新しい javadoc の表示についてのコメントやご提案
Java は、米国およびその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.