TCP client won't connect

J

jana

Guest
Hi, I'm trying to run a server and a client on my laptop. The server starts, but I get an error when I try to create a client.
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Create Event
for object oClient:

Could not connect client to server.
at gml_Script_client_connect
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_client_connect (line 0)
gml_Object_oClient_Create_0
This code runs in the client's Create event:
Code:
connect = client_connect("my.ip.address", 50000);
and here's the script client_connect:
Code:
var
ip = argument0,
port = argument1,
connect = -1;

socket = network_create_socket(network_socket_tcp);
while ( (connect < 0) && (port <= 65000) )
{
   connect = network_connect_raw(socket, ip, port);
   port += 1;
}
if (connect < 0)
{
    show_error("Could not connect client to server.", true);
}
I'd be grateful for any ideas on why it's not connecting.
 

The-any-Key

Member
I guess the server is nonGM? (You use raw)
It often bad practice to connect this way. In a loop. Try wait some (let the game go) before you try another port and connect again. Gm may overload.
 
Top