Copy link to clipboard
Copied
I'm trying to make a TCP Flash game, and though I got it to work, I can't seem to get it to connect to an IP address using a string. The reason I want to do this is so that players can type in an IP address they'd want to connect to.
Here's what I have so far:
sock.connect('192.168.0.22',8080);
It works and connects to my IP address, and anyone else on the same LAN can connect to it as well, but if the server is on a DIFFERENT computer in the house, this IP would not work. That's why I want to be able to have a string to type in-game.
I tried this:
var ipaddress:String = '192.168.0.22';
sock.connect(ipaddress,8080);
But it does not work. Any ideas? Thanks in advance.
Something else is not working.
sock.connect('192.168.0.22',8080);
var ipaddress:String = '192.168.0.22';
sock.connect(ipaddress,8080);
Those are equivalent statements, and connect takes a string for IP - it does not matter if you define the string in the connect itself, or prior to it.
Copy link to clipboard
Copied
Something else is not working.
sock.connect('192.168.0.22',8080);
var ipaddress:String = '192.168.0.22';
sock.connect(ipaddress,8080);
Those are equivalent statements, and connect takes a string for IP - it does not matter if you define the string in the connect itself, or prior to it.
Copy link to clipboard
Copied
Somehow, that worked! Thank you.