Processing, 類Server
中的disconnect()
用法介紹。
用法
server.disconnect(client)
參數
server
(Server)
服務器類型的任何變量client
(Client)
客戶端斷開連接
返回
void
說明
斷開特定客戶端。
例子
import processing.net.*;
int port = 10002;
Server myServer;
void setup()
{
size(400, 400);
background(0);
myServer = new Server(this, port);
}
void draw()
{
// Get the next available client
Client thisClient = myServer.available();
// If the client is not null, and says something, display what it said:
if (thisClient !=null) {
String whatClientSaid = thisClient.readString();
// If the client says "exit", disconnect it
if (whatClientSaid.equals("exit\r\n")) {
thisClient.write("You will be disconnected now.\r\n");
println(thisClient.ip() + "\t has been disconnected");
myServer.disconnect(thisClient);
}
}
}
相關用法
- Processing Server.write()用法及代碼示例
- Processing Server.active()用法及代碼示例
- Processing Server.stop()用法及代碼示例
- Processing Server.available()用法及代碼示例
- Processing Server用法及代碼示例
- Processing Serial.readChar()用法及代碼示例
- Processing Serial.read()用法及代碼示例
- Processing Serial.available()用法及代碼示例
- Processing Serial.lastChar()用法及代碼示例
- Processing Serial.readStringUntil()用法及代碼示例
- Processing Serial.readBytes()用法及代碼示例
- Processing Serial.list()用法及代碼示例
- Processing Serial用法及代碼示例
- Processing Serial.clear()用法及代碼示例
- Processing Serial.buffer()用法及代碼示例
- Processing Serial.readBytesUntil()用法及代碼示例
- Processing Serial.bufferUntil()用法及代碼示例
- Processing Serial.readString()用法及代碼示例
- Processing Serial.stop()用法及代碼示例
- Processing Serial.last()用法及代碼示例
- Processing Serial.write()用法及代碼示例
- Processing Serial.serialEvent()用法及代碼示例
- Processing SawOsc.pan()用法及代碼示例
- Processing String用法及代碼示例
- Processing StringList用法及代碼示例
注:本文由純淨天空篩選整理自processing.org大神的英文原創作品 Server.disconnect()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。