Copy link to clipboard
Copied
Hi I am having an issue with getting a network client to connect to the server
Server ServerSocketExample.as ServerSocket - Adobe ActionScript® 3 (AS3 ) API Reference
Client SocketExample.as Socket - Adobe ActionScript® 3 (AS3 ) API Reference
If the client air app runs on the same computer as the server then the clients connects.
Server pc
192.168.1.5
255.255.255.0
gateway 192.168.1.1
Server setup
Local ip 127.0.0.1
Local port 80 (or adjust in client, have tried port 50000)
Now when I put the client on another computer on the same network I get
ioErrorHandler: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2031: Socket Error. URL: localhost" errorID=2031]
Network Computer
192.168.1.6
255.255.255.0
gateway 192.168.1.1
It does say that
"To run the example, you need a server running on the same domain where the SWF resides (in the example, localhost
) and listening on port 80."
Any ideas on how I can get a network client to join the server?
You should try connecting to 192.168.1.5 (or whatever the IP is of the server) instead of localhost if the client is on another computer.
Copy link to clipboard
Copied
You should try connecting to 192.168.1.5 (or whatever the IP is of the server) instead of localhost if the client is on another computer.
Copy link to clipboard
Copied
That is correct just worked it out here socket server and network client connection error 2031
Copy link to clipboard
Copied
Also, low ports (below 1024) are not recommended to use. Port 80 is usually used for http servers and depending on the software environment of your computers you might easily run into trouble, especially if you want to distribute the app to other users as well.
It's recommended pick a higher port which is not used widely
Copy link to clipboard
Copied
A side question
With the client SocketExample.as Socket - Adobe ActionScript® 3 (AS3 ) API Reference
How can the client send a new message to the server from outside of the CustomSocket class?
Update
worked it out need a send function for socket connection