Author Topic: Occasional exception on tcplobbyserver  (Read 2046 times)

thenick191

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 25
    • View Profile
Occasional exception on tcplobbyserver
« on: June 01, 2015, 11:12:57 AM »
Once in a while I get an exception in the ThreadFunction() on TNTcpLobbyServer on the line:
  1. tc.StartReceiving(mListener.AcceptSocket());

With people connecting from around the world it happens probably every other day. I'm guessing a connection did not terminate correctly and the socket didn't close, so the server thinks it's still open?

Any idea what could be done to fix this?

thenick191

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 25
    • View Profile
Re: Occasional exception on tcplobbyserver
« Reply #1 on: June 01, 2015, 03:51:29 PM »
I changed the code and so far so good, maybe it works? I'll let you know if it breaks in the next day or so.

  1. while (mListener != null && mListener.Pending())
  2.                         {
  3.                                 TcpProtocol tc = new TcpProtocol();
  4.                 try
  5.                 {
  6.                     Socket sock = mListener.AcceptSocket();
  7.                     if (sock != null && sock.Connected)
  8.                     {
  9.                         tc.StartReceiving(sock);
  10.                         mTcp.Add(tc);
  11.                     }
  12.                 }
  13.                 catch
  14.                 {
  15.                     Console.WriteLine("THAT BAD EXCEPTION");
  16.                 }
  17.                         }

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Occasional exception on tcplobbyserver
« Reply #2 on: June 01, 2015, 09:43:31 PM »
It's likely one of many issues that I already fixed on my end. Windward's launch with hundreds of people cramming into the same server has revealed all kinds of issues that I had to frantically fix. Next update to TNet will be a big one as I had to do a lot... As usual, Pro access level users can use it already, while others will get it in a week or two.