📄 iserverlistener.java
字号:
/* The Bluetooth Library for client-server communication Copyright (C) 2006 Martin Vysny This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */package net.sf.btw.btlib;import java.io.DataInputStream;/** * <p> * Server uses this interface to notify listener about events. * </p> * <p> * Generally, event handlers should not fire an exception while in the handler. * If an exception is thrown, it is logged and * {@link IErrorListener#errorOccured(byte, int, boolean, Exception)} is called. * If the exception is thrown while a connection is being created the connection * will be destroyed. * </p> * * @author Martin Vysny * */public interface IServerListener extends IErrorListener { /** * New client has connected to the server. In this phase you may send * packets. * * @param id * new ID of the client * @param name * client's device name. */ void clientConnected(final byte id, final String name); /** * A client has disconnected. * * @param id * id of the client. * @param name * client's device name. */ void clientDisconnected(final byte id, final String name); /** * <p> * A message has arrived from client. You may read the message from the * stream, or you may use the byte array. You must NOT block in this method - * no packets are received until this method finishes. * </p> * <p> * Warning: you should not close the stream - the stream cannot be reused * when closed. * </p> * * @param clientID * message arrived from this client. * @param name * client's device name. * @param message * the message contents. * @param messageLength * the length of data contained in the message array * @param stream * stream reading bytes from the message, initially positioned * over the first byte of the message. */ void messageArrived(final byte clientID, final String name, byte[] message, int messageLength, DataInputStream stream);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -