network_create_server()


マルチプレイ

network_create_server

新しいネットワークサーバを生成します

構文

network_create_server(type, port, max_client);
type
生成するサーバの種類(下記のリストを参照)
port
ポート番号
max_client
接続可能なクライアントの最大数

戻り値

Real
サーバのインスタンス番号

説明

This function is used to create a new network server for your game, using one of the permitted connection protocols (see the constants listed below). You supply the server type, then give it a port to use, and finally the number of maximum connections that should be permitted at any one time to the server (note that this number is up to you, but too many connected clients will saturate the network or the device CPU won’t be able to handle the processing of that number of players, so use with care). The function returns a unique id which should be used stored in a variable and used to identify the server in all further network functions, or a value of less than 0 if the connection fails.

サーバの種類の定数

定数名説明
network_socket_tcpTCPを使用してWebサーバを生成します
network_socket_udpUDPを使用してWebサーバを生成します
network_socket_bluetoothBluetoothソケットを生成します(現在利用できません!)

注意

Free版ではTCP接続するクライアントは1つのみに限られます

var port = 6510;
server = network_create_server(network_socket_tcp, port, 32);
while (server < 0 && port < 65535)
{
  port++
  server = network_create_server(network_socket_tcp, port, 32);
}

上記コードは6510番ポートを使用するTCPのサーバを生成し、もしそのポートが使用できなければ空いているポートを探してサーバを生成します

Wiki内検索

#search(): You already view a search box

MENU

ドキュメント

GMLリファレンス

2ch

その他



最新の30件

2024-03-07 2023-08-09 2023-05-21 2023-05-20 2023-05-04 2022-10-13 2022-07-21 2022-07-02 2022-04-06 2021-11-30 2021-11-26 2021-10-03 2021-09-23 2021-08-15 2021-06-02 2021-01-23 2021-01-21 2021-01-19 2021-01-18 2021-01-16 2021-01-15

人気の10件

今日の10件



これまでの訪問者: 1511
今日の訪問者: 1
昨日の訪問者: 0
閲覧者: 6