com.jme3.network.base
クラス DefaultServer

java.lang.Object
  上位を拡張 com.jme3.network.base.DefaultServer
すべての実装されたインタフェース:
Server

public class DefaultServer
extends java.lang.Object
implements Server

A default implementation of the Server interface that delegates its network connectivity to kernel.Kernel.


コンストラクタの概要
DefaultServer(java.lang.String gameName, int version, Kernel reliable, Kernel fast)
           
 
メソッドの概要
 void addConnectionListener(ConnectionListener listener)
          Adds a listener that will be notified when new hosted connections arrive.
 void addMessageListener(MessageListener<? super HostedConnection> listener)
          Adds a listener that will be notified when any message or object is received from one of the clients.
 void addMessageListener(MessageListener<? super HostedConnection> listener, java.lang.Class... classes)
          Adds a listener that will be notified when messages of the specified types are received from one of the clients.
 void broadcast(Filter<? super HostedConnection> filter, Message message)
          Sends the specified message to all connected clients that match the filter.
 void broadcast(Message message)
          Sends the specified message to all connected clients.
 void close()
          Closes all client connections, stops and running processing threads, and closes the host connection.
 HostedConnection getConnection(int id)
          Retrieves a hosted connection by ID.
 java.util.Collection<HostedConnection> getConnections()
          Retrieves a read-only collection of all currently connected connections.
 java.lang.String getGameName()
          Returns the 'game name' for this server.
 int getVersion()
          Returns the game-specific version of this server used for detecting mismatched clients.
 boolean isRunning()
          Returns true if the server has been started.
 void removeConnectionListener(ConnectionListener listener)
          Removes a previously registered connection listener.
 void removeMessageListener(MessageListener<? super HostedConnection> listener)
          Removes a previously registered wildcard listener.
 void removeMessageListener(MessageListener<? super HostedConnection> listener, java.lang.Class... classes)
          Removes a previously registered type-specific listener from the specified types.
 void start()
          Start the server so that it will began accepting new connections and processing messages.
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

DefaultServer

public DefaultServer(java.lang.String gameName,
                     int version,
                     Kernel reliable,
                     Kernel fast)
メソッドの詳細

getGameName

public java.lang.String getGameName()
インタフェース Server の記述:
Returns the 'game name' for this server. This should match the 'game name' set on connecting clients or they will be turned away.

定義:
インタフェース Server 内の getGameName

getVersion

public int getVersion()
インタフェース Server の記述:
Returns the game-specific version of this server used for detecting mismatched clients.

定義:
インタフェース Server 内の getVersion

start

public void start()
インタフェース Server の記述:
Start the server so that it will began accepting new connections and processing messages.

定義:
インタフェース Server 内の start

isRunning

public boolean isRunning()
インタフェース Server の記述:
Returns true if the server has been started.

定義:
インタフェース Server 内の isRunning

close

public void close()
インタフェース Server の記述:
Closes all client connections, stops and running processing threads, and closes the host connection.

定義:
インタフェース Server 内の close

broadcast

public void broadcast(Message message)
インタフェース Server の記述:
Sends the specified message to all connected clients.

定義:
インタフェース Server 内の broadcast

broadcast

public void broadcast(Filter<? super HostedConnection> filter,
                      Message message)
インタフェース Server の記述:
Sends the specified message to all connected clients that match the filter. If no filter is specified then this is the same as calling broadcast(message) and the message will be delivered to all connections.

Examples:

    // Broadcast to connections: conn1, conn2, and conn3
    server.broadcast( Filters.in( conn1, conn2, conn3 ), message );

    // Broadcast to all connections exception source
    server.broadcast( Filters.notEqualTo( source ), message );
  

定義:
インタフェース Server 内の broadcast

getConnection

public HostedConnection getConnection(int id)
インタフェース Server の記述:
Retrieves a hosted connection by ID.

定義:
インタフェース Server 内の getConnection

getConnections

public java.util.Collection<HostedConnection> getConnections()
インタフェース Server の記述:
Retrieves a read-only collection of all currently connected connections.

定義:
インタフェース Server 内の getConnections

addConnectionListener

public void addConnectionListener(ConnectionListener listener)
インタフェース Server の記述:
Adds a listener that will be notified when new hosted connections arrive.

定義:
インタフェース Server 内の addConnectionListener

removeConnectionListener

public void removeConnectionListener(ConnectionListener listener)
インタフェース Server の記述:
Removes a previously registered connection listener.

定義:
インタフェース Server 内の removeConnectionListener

addMessageListener

public void addMessageListener(MessageListener<? super HostedConnection> listener)
インタフェース Server の記述:
Adds a listener that will be notified when any message or object is received from one of the clients.

Note about MessageListener multithreading: on the server, message events may be delivered by more than one thread depending on the server implementation used. Listener implementations should treat their shared data structures accordingly and set them up for multithreaded access. The only threading guarantee is that for a single HostedConnection, there will only ever be one thread at a time and the messages will always be delivered to that connection in the order that they were delivered. This is the only restriction placed upon server message dispatch pool implementations.

定義:
インタフェース Server 内の addMessageListener

addMessageListener

public void addMessageListener(MessageListener<? super HostedConnection> listener,
                               java.lang.Class... classes)
インタフェース Server の記述:
Adds a listener that will be notified when messages of the specified types are received from one of the clients.

定義:
インタフェース Server 内の addMessageListener

removeMessageListener

public void removeMessageListener(MessageListener<? super HostedConnection> listener)
インタフェース Server の記述:
Removes a previously registered wildcard listener. This does not remove this listener from any type-specific registrations.

定義:
インタフェース Server 内の removeMessageListener

removeMessageListener

public void removeMessageListener(MessageListener<? super HostedConnection> listener,
                                  java.lang.Class... classes)
インタフェース Server の記述:
Removes a previously registered type-specific listener from the specified types.

定義:
インタフェース Server 内の removeMessageListener