question

yexioamu avatar image
0 Likes"
yexioamu asked yexioamu commented

Why the serveraccept function in socket limit 50?

Hello, when i create a server socket in flexsim, and send message by external system(WMS), becasue the external system has a lot of task, so it use thread to send message to flexsim server, it means flexsim server need to accept different connection from different port, i create new connetion in loop by code like this:

int client = serveraccept(1);
while(client == 0){
      clientclose(client);
      int client = serveraccept(1);
}

it work fine at first, but when the client value reach 50, it not work, does the return value of serveraccept is 50, it limit 50 connection?

Then, i solved it by ending the server and create a new server when the connections reach 50.

Could someone tell me the reason? Thanks!

FlexSim 21.2.4
socket
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Jacob Gillespie avatar image
2 Likes"
Jacob Gillespie answered yexioamu commented

Yes there is a limit of 50 connections. The problem is you aren't closing the socket correctly.

Instead of calling clientclose() you should be calling servercloseconnection().

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

yexioamu avatar image yexioamu commented ·

Thank you, it works fine! when i calling servercloseconnection(), the connection can be close correctly.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.