B4J Question Socket Connection Limit

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

I am using code like the following..

B4X:
Sub Process_Globals
   Private server As ServerSocket
   Private astream As AsyncStreams
End Sub
Sub AppStart (Args() As String)
   server.Initialize(51042, "server")
   server.Listen
   StartMessageLoop
End Sub
Sub server_NewConnection (Successful As Boolean, NewSocket As Socket)
   Log("New connection")
   If Successful Then
     astream.Initialize(NewSocket.InputStream, NewSocket.OutputStream, "astream")
   End If
   server.Listen
End Sub
Sub astream_NewData (Buffer() As Byte)
   Log(BytesToString(Buffer, 0, Buffer.Length, "utf8"))  
   astream.Write("received!".GetBytes("utf8"))
End Sub

Just wondering, is there a limit of the number of connections that can connect at one time ?

For Example, if a user connects but doesn't disconnect, and then other user connects but doesn't disconnect etc.

If so, what is the limit and can it be changed ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top