Skip to main content
Inspiring
January 8, 2018
Answered

Socket - connect multiple clients to a server?

  • January 8, 2018
  • 1 reply
  • 788 views

Hi using the following

ServerSocket ServerSocket - Adobe ActionScript® 3 (AS3 ) API Reference

Socket class Socket - Adobe ActionScript® 3 (AS3 ) API Reference

How can you connect more than 1 client to a server?

My problem is when the third clients connects to the server the second client loses its socket connection can no longer send or get data from server.

UPDATE

1 getting Error: Error #2030: End of file was encountered. when second client sends data to server at onClientSocketData in ServerSocketExample

2 When the third client connects The buffer becomes blank and clientSocket.bytesAvailable is 0 at onClientSocketData in ServerSocketExample

3 Ok think i am getting somewhere, when 1 client is connected and sends data to the server the buffer has object data, however when the second client joins the buffer for the first client is now blank when it sends data to the server (the second client buffer has object data).

4. Still having issues with this, i am thinking that when the second client joins the server (3 users connected) it replaces the connection from the first client. The server stops sending data to the first client and when the first client tries and sends data to the server the bytesAvailable is 0.

This topic has been closed for replies.
Correct answer veggieman25

still having issues connecting more than 1 client to a server, i am thinking that the client connection is overriding itself when a new client joins.

Ok worked it out,

In the ServerSocketExample.as class onConnect function you have to create and store a new event.socket for each connection instead of overriding the one already made.

1 reply

veggieman25AuthorCorrect answer
Inspiring
January 24, 2018

still having issues connecting more than 1 client to a server, i am thinking that the client connection is overriding itself when a new client joins.

Ok worked it out,

In the ServerSocketExample.as class onConnect function you have to create and store a new event.socket for each connection instead of overriding the one already made.