Processing, serverEvent()
用法介紹。
用法
void serverEvent(server, client) {
statements
}
參數
server
客戶端連接的服務器client
客戶端連接到服務器statements
任何有效的陳述
說明
serverEvent() 中的代碼在新客戶端連接到在程序中創建的服務器時運行。
例子
// Creates a server that prints new client's IP addresses.
import processing.net.*;
int port = 10002;
Server myServer;
void setup()
{
size(400, 400);
background(0);
myServer = new Server(this, port); // Starts a server on port 10002
}
void draw() {
// Nothing happens here, everything happens inside ServerEvent()
}
// ServerEvent message is generated when a new client connects
// to an existing server.
void serverEvent(Server someServer, Client someClient) {
println("We have a new client: " + someClient.ip());
}
有關的
相關用法
- Processing settings()用法及代碼示例
- Processing setLocation()用法及代碼示例
- Processing setResizable()用法及代碼示例
- Processing setup()用法及代碼示例
- Processing selectOutput()用法及代碼示例
- Processing setTitle()用法及代碼示例
- Processing second()用法及代碼示例
- Processing selectFolder()用法及代碼示例
- Processing selectInput()用法及代碼示例
- Processing set()用法及代碼示例
- Processing scale()用法及代碼示例
- Processing splice()用法及代碼示例
- Processing super用法及代碼示例
- Processing subset()用法及代碼示例
- Processing saveJSONArray()用法及代碼示例
- Processing strokeJoin()用法及代碼示例
- Processing saveXML()用法及代碼示例
- Processing switch用法及代碼示例
- Processing sqrt()用法及代碼示例
- Processing save()用法及代碼示例
- Processing saveStrings()用法及代碼示例
- Processing saveTable()用法及代碼示例
- Processing shorten()用法及代碼示例
- Processing saturation()用法及代碼示例
- Processing spotLight()用法及代碼示例
注:本文由純淨天空篩選整理自processing.org大神的英文原創作品 serverEvent()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。