network_create_socket(type);
参数 | 描述 |
---|---|
type | The type of socket connection to create (see the constants listed below). |
返回: Real(实数)
This function is used to create a new client socket for your game to communicate over the network. You must define the socket type (see the list of constants below) and the function will return a unique id for that socket, which should be used in all further function calls for that socket, or a value of less than 0 if the connection fails.
NOTE: You can use the IP "127.0.0.1" to connect back to the same device that is running the game.
常量 | 描述 |
---|---|
network_socket_tcp | 使用TCP协议创建一个网络套接字。 |
network_socket_udp | 使用UDP协议创建一个网络套接字。 |
network_socket_bluetooth | 创建一个蓝牙套接字(尚不可用!) |
client =
network_create_socket(network_socket_tcp);
network_connect( client, �192.134.0.1�, 6510 );
上述代码会新建一个TCP套接字然后尝试通过之去连接指定的IP地址的6510端口。