Thank you for the answering FrostyCat!
Actually, I made it! Now I could connect client side and server side even in 4G or other Wi-Fi.
For anyone who watch this thread because of the same problem, I leave the method for Windows10.
Note that I'm a beginner in networking so something might be wrong, someone who notice that, please leave the post.
For now, I'll just set the port to 4321.
First, you need to port forwarding. You have to set up your router to do it.
The method for this is really depends on your router. Check out the manual or the website.
For me, I typed in the ip address what the manual says in url. Then type in username and password. Mostly, username is "admin".
Login and find port forwarding settings, typing in your ip address and the port. Something like that.
Second, you need to setting up firewall for port forwarding.
Control Panel > System and Security > Windows Defender Firewall > Advanced settings > Ringt Click the Inbound Rules . Press New Rule > Select Port and press Next > TCP, Specified local port and tipe in 4321 > Allow the connection > only Private > Type the Name whatever you want > Finish.
Same as the Outbound Rules.
Last, Setting up in Gamemaker.
In Server.yyp, create a obj_server.
in Create event:
Code:
server_port = 4321;
clientNum = 4;
server = network_create_server(network_socket_tcp,server_port,clientNum);
In Game End event:
Then switch to Cilent.yyp.
In Create Event:
Code:
var type = network_socket_tcp;
var ip = "Your global IP address";
var port = 4321;
socket = network_create_socket(type);
network_connect(socket,ip,port);
Then test it out. First run Server in your computer and then run Client in another computer or your phone.
Note that Server side computer and Client side devices are not using same Wi-Fi. It didn't connect in my case.
Also you need to know whether it is connected or not.
In obj_server, add Async-Networking event:
Code:
var type = async_load[? "type"];
if(type == network_type_connect){
show_debug_message("ip = " + string(async_load[? "ip"]));
show_debug_message("id = " + string(async_load[? "id"]));
show_debug_message("socket = " + string(async_load[? "socket"]));
}
above code will tell us it is connected or not by showing some debug message.
That's all I know. Again, It might not be the best way, I'm just telling what I did for it.