-1

So, I'm working on a Server/Client application at the moment, and need to test certain scenarios where multiple clients connect to the server and interact with each other.

The problem here is as follows: I somehow can't connect with more than one client per machine, the server just does not accept any connection attempt after the first one connected.

I know that it SHOULD work, as tons of other applications support multiple clients on one machine too.

I could - of course - test this on another machine, but I do not want to compile and send my program to my secondary computer each time after I made changes to the code.

I hope I described my problem well and provided enough info so that you can help me with that case.

Psylution
  • 183
  • 1
  • 5
  • 1
    You may want to have a look at [this answer](http://stackoverflow.com/a/10069095/5117760). Also, have you confirmed that your server can even handle multiple clients at all? – NitrogenReaction Aug 02 '15 at 03:06
  • I'm afraid I just don't believe this problem as stated. TCP/IP servers have a backlog queue which will allow multiple inbound connections, even if the server is incorrectly coded in a single thread, which yours almost certainly is. More likely what happening is that multiple clients *can* connect, but won't get *serviced* until the prior one completes. Please clarify, and post your server accept loop. – user207421 Aug 02 '15 at 03:30
  • 1
    I agree with @EJP, please provide a [minimal, complete, and verifiable example](http://stackoverflow.com/help/mcve), that will make it much easier to assist you. – NitrogenReaction Aug 02 '15 at 16:23
  • I figured out what the problem was. It apparently was my own stupidity. To test with multiple clients, I started one client exported as executable from my desktop, and the other one from the IDE itself. The one loading from the desktop, having no initial config file, just connected to the default IP, which was a wrong one. And no, my accept loop is perfectly fine, and every connection got its own thread on the server, no worries there. Thanks for you help tho :) – Psylution Aug 06 '15 at 12:09

1 Answers1

0

The issue is probably that the way your server is coded it either doesn't accept multiple clients at all or it is dependant on all clients having a unique IP address.

I would suggest testing with 2 clients on different computers just to see if it can accept multiple clients at all. That will help narrow down the exact issue to one of the ones I mentioned above.

Disclaimer: I'm not an expert in the field of networking, but I've attempted to assist to the best of my understanding

  • Exactly what network configuration problems would cause this? – user207421 Aug 02 '15 at 03:27
  • @EJP ok, I'm not an expert in networking so I figured I should try and cover all my bases. I'll revise my answer shortly based on your feedback. Thanks for your feedback. – NitrogenReaction Aug 02 '15 at 03:28
  • So if you don't know the answer why post one? – user207421 Aug 02 '15 at 03:31
  • @EJP I know something about networking, but I was basing my assumption on something I misread/apparently incomplete knowledge of that particular area of networking. I will add a disclaimer that I'm not an expert in the field (Unless you think it would be better to remove the answer entirely). – NitrogenReaction Aug 02 '15 at 03:35
  • I tested it on up to 8 different machines simultanously, and it worked. And yes, maybe a local configuration is the problem, but I can not tell which one or if there even is such a configuration parameter (working on win8, but also linux) I'll try to run the server on another machine and run multiple clients there, if it works there, I know where to look for a fix. – Psylution Aug 02 '15 at 07:05
  • @Psylution, a network configuration problem is quite unlikely, but if you've ensured that your server can handle multiple clients and has no dependence on IP addresses then a network configuration problem is the only place left to look. I suggest trying to connect your clients using localhost or 127.0.0.1 as the server address. If that works but using whatever you're using currently(If different) doesn't, then that points to something with your router/network. – NitrogenReaction Aug 02 '15 at 16:21